"Ralf Juengling" juenglin@cse.ogi.edu writes:
But what is the reason for having GetModuleFileName return the system dir for "builtin DLLs"?
Because we don't know the real path, and even if we did there is no guarantee that it is accessible from a Windows drive.
Also, why does it behave differently for the two programs, as I reported in my initial posting; is one of the two cases exhibiting a bug?
Because in one case you used a .exe.so and in the other a .dll.so, they behave slightly differently. It's not really a bug, just a side effect of the fact that you can load a .exe.so by specifying its path explicitly, which you cannot do for builtin dlls. This could be changed, but there hasn't been any real need for that yet.