Aurel300/ammer

GCC Native Ext. Build Not Working on Windows

Closed this issue · 2 comments

I'm really not sure what domain this problem falls within or if any (maybe something I can fix on my own), but I have a native library,

take these two Makefiles:
Makefile.win:

all: odbc.dll
    @:

odbc.dll: odbc.obj
    gcc -shared -mwindows -o odbc.dll odbc.obj -lodbc32

odbc.obj: odbc.c
    gcc -c -mwindows odbc.c -o odbc.obj -lodbc32

.PHONY: all

and Makefile.msvc:

all: odbc.dll
    @:

odbc.dll: odbc.obj
    cl /LD odbc.obj /link /OUT:odbc.dll /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x86" odbc32.lib

odbc.obj: odbc.c
    cl /c odbc.c 

.PHONY: all

Both of them work, they both produce "odbc.dll"; Makefile.msvc also produces exp and lib files.

For the GCC approach, I used dumpfile /EXPORTS odbc.dll > odbc.exports and created a DEF file to then create a LIB/EXP file from using the Microsoft lib tool.

This works for GCC, so end result after building I end up with the same files:

  • odbc.dll
  • odbc.lib
  • odbc.exp

The problem is, odbc.dll cannot be loaded by ammer_odbc.hdll (presumably that's where this failure happens). I get this error: src\module.c(321) : FATAL ERROR : Failed to load library ammer_odbc.hdll

Does anyone have experience using GCC built DLLs with Ammer in Windows? I know other platforms require GCC, so I imagine it has to be possible on windows as well.

I'm a C/C++ rookie, in this case I am going to assume that because I installed HL via binaries, it was probably built via the MSVC toolchain.

If I built it via GCC I imagine this should work. Anywho, closing for now.

I don't think that a different compiler framework should cause a DLL to not work properly. However, a version mismatch might be the cause? Anyway, I think these types of issues might be resolved when I get CI setup (#24).