Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find out my .exe's entry-point function?

I feel very foolish asking this question, but please bear with me and read the symptoms before commenting "it's main(), duh".

I'm working on a project in Visual Studio Express 2012. We have hitherto built only for the Win32 (x86) platform but I am converting the .exe build to 64 bit. I now have a fully linked .exe, but a funny thing happened along the way: the entry-point no longer gets called.

The entry-point to the (C++, console) program is a C++ function declared at file scope with the following signature: int main(int argc, char * argv[]). This function has happily worked in the x86 executable since day 1. It is not being called on x64:

  • The linker does not complain that it can't find the entry-point.
  • The loader does not complain that it can't find the entry-point.
  • When I run the exe from command line, it starts and exits immediately with exit code 127.
  • gdb, e.g., says "During startup program exited with code 0xc000007b."
  • There is no output whatsoever on stdout or stderr.
  • If I put fun things in the main like int * p(nullptr); *p = 5;, the program doesn't crash (even without this I'm certain main() isn't running).

What could be causing this issue? How can I debug it? I'm not sure where to set a breakpoint in my debuggers due to the fact that none of my code ever runs...

like image 694
0xbe5077ed Avatar asked Sep 05 '25 01:09

0xbe5077ed


1 Answers

0xc000007b is STATUS_INVALID_IMAGE_FORMAT. That is, the operating system never even gets the binary loaded far enough to start executing it.

There could be something wrong in your compilation settings. However, usually when I have seen this error, the problem has been in the 64-bit application trying to dynamically link to a 32-bit DLL.

Check your libraries, and verify your paths point to the 64-bit versions of any DLLs.

like image 180
jlahd Avatar answered Sep 07 '25 11:09

jlahd