Need to get .obj file names of Executable(which one is crrently executing) at runtime programatically in VC++?

StackOverflow https://stackoverflow.com/questions/2578315

Question

Suppose I have a VC++ project containing number of Source (.cpp) files (e.g. 5), it will generate 5 .obj files (corresponding to my .cpp files not all kernel and OS layers including .obj files).

My project includes xyz_1.cpp, xyz_2.cpp, xyz_3.cpp, xyz_4.cpp, and will corresponds with 4 respective .objs files.

How can I get the names of these 4 .obj files at runtime? On runtime I need to check how many obj files there are and their names.

I don't need all kernel or OS layer .obj's, I only need .obj's of my .cpp's.

Regards,

Usman

Was it helpful?

Solution

The .obj file names are not standard. some compilers hay create ones that correspond to the .cpp files, others may create ones with random names (VC actually does that when configured with link time code generation) while others may skip this stage completely.

So there is no well defined answer to your question. it is compiler and compilation flags dependent.

Furthermore, there is no way to get this information that I know of.

OTHER TIPS

It sounds like you need to use Microsoft's dbghelp.dll library and their Debug Interface Access SDK.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top