FLI "trying to call to unresolved external function"
Hi there,
I have been trying to link some foreign C code, to no avail so far. The
problem could be some simple configuration, probably, I do not have much
experience using FLI. I apologize if it is something straight-forward that
everyone knows.
It seems that Lispworks 6.1.1 cannot resolve to foreign function in a
supplied dll. I thought it could have to do with my C code so tried to
generate a sample DLL in VC++ Express 2010 without changing anything to
see if that works but it doesn't.
One of the sample functions looks like this:
__declspec(dllexport) int fnmiles(void)
{
return 42;
}
My lisp FLI definition looks like this:
(fli:define-foreign-function
(fnmiles "fnmiles" :source) nil
:result-type :int
:language :ansi-c)
the module registers via fli:register-module seemingly no problem. When I
try to run the function, I get this error:
CL-USER 5 > (fnmiles)
Error: Foreign function FNMILES trying to call to unresolved external
function "fnmiles".
I am not sure what the problem is. One of the suspicions that I had is
that the code generated by the Visual C++ is not ansi-c compliant even
though I do not use any C++ specific code, however that is pretty much how
far my guesses go for me. I tried creating dlls using example code from
the Internet using gnuc but had exact the same problem.
If someone would have a simple example of C code that links to Lispworks
that would be awesome.
Thanks,
Yuri
_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html