0

I successfully managed to compile and link the basic example from the Allegro wiki (completely unchanged) by downloading the binaries and setting up GCC on mingw32 accordingly. Compiling doesn't produce any errors, neither does linking with the library. No other libraries are being used at this point.

When the resulting executable is run, no output is presented to the output streams and the program exits with code 127.

I'm compiling using GCC 9.2.0 under 32-bit MinGW and running on 64-bit Windows. There would be linking errors in case of a mismatch, but it's not the case (sadly).

I have no idea what's causing this and would gladly move on with development if this hadn't put it on hold. All help is appreciated.

Edit 1

GDB isn't much help here, it only says the following. However it does give a better idea of what the exit code means - from what I read 0xc0000139 is when Windows fails to load a DLL. I don't fully understand why, the DLLs are on the PATH (specifically in the MinGW /bin directory). I also tried putting them in the directory of the executable to no avail.

(gdb) b main
Breakpoint 1 at 0x401421: file main.c, line 6.
(gdb) run
Starting program: D:\dev\genart-allegro/genart-allegro.exe
[New Thread 4712.0x1a2c]
[New Thread 4712.0x1674]
[New Thread 4712.0xfac]
[New Thread 4712.0x34d4]
During startup program exited with code 0xc0000139.

Edit 2

Statically linking Allegro solves the issue, however I still cannot explain why dynamic linking doesn't work.

michalwa
  • 164
  • 17
  • maybe compile with `-g -O0` and run it through `gdb`? Break at `main` and step through and see what is happening. – Jason Sep 01 '20 at 15:24
  • 1
    Linking properly during compilation doesn't mean you are linking properly at runtime. I'm not much help on a windows machine, but make sure whatever shared library you are trying to link to is in the correct location. (system32?) – Jason Sep 01 '20 at 15:56

0 Answers0