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

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

문제

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

도움이 되었습니까?

해결책

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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top