Page 1 of 1

DLL import failing

PostPosted: Mon Jul 16, 2018 2:14 pm
by dexterlagan
Hi folks,

First post ever. I'm attempting to compile the Genann neural network library into a DLL for import into newLISP.

I updated the C source and its header to comply with either STDCALL or CDECL conventions (tried both with no success). I tried several methods to output a DLL out of the C source, which all work fine except when importing in newLISP. The methods I tried are described here : ... ith-mingw/

I checked the exports using Dependency Walker, and all functions are exported correctly (at least when using CDECL, somehow the STDCALL one still showed up as a C export.
No matter what I do newLISP returns the usual import error when attempting to import the DLL :

ERR: problem loading library in function import : "genann.dll"

My import line :

(import "genann.dll" "genann_init") (when stdcall)
(import "genann.dll" "genann_init" "cdecl")

I tried using the absolute path (with slashes) to the DLL, as well as both calling conventions, to no avail.
I tried compiling the DLL both with gcc straight to DLL (-shared etc.) and through mingw's dllwrapper, to the same result. The DLL file I'm getting seems legit, and I have no problem importing it from C.

Has anybody encountered this problem?

Thanks in advance!


Re: DLL import failing

PostPosted: Tue Aug 21, 2018 1:46 pm
by dexterlagan
I figured it out. Lutz pointed out I was using the 32 bits version of MingW, with the 64 bits version of newLISP. All I had to do is :

1) install MingW64
2) compile the genann source with:
gcc -m64 genann.c -shared -o genann.dll