Suppose source code file name is
DIR * directory;
struct dirent * direct;
direct = readdir(directory);
You know the name of the executable when you're building it; the
simplest solution is to embed it in the program, using a
option to define a macro on the command line.
Other than that, the generic answer is that it isn't possible:
The real question is why you want to do this. What is the problem you are trying to solve?