[Openmcl-devel] libcurl init functions not found

Gary Byers gb at clozure.com
Sun Dec 30 17:29:24 PST 2007



On Sun, 30 Dec 2007, Jimmy Miller wrote:

> This might be a libcurl problem, but I'm pretty sure it's more related to CCL.
>
> I've installed the libcurl library, and when I try to call a foreign
> function such as:
>
> (#_curl_easy_setopt)
>
> I get an expected error about how the foreign function was missing
> arguments.  However, when I try to call one of the libcurl init
> functions like
>
> (#_curl_easy_init)
>
> CCL complains that it can't resolve the foreign symbol.  The same
> thing happens with curl_multi_init.  I've tried calling nearly every
> other libcurl function, and all of them can be resolved, so what is
> the problem with these two specific functions not being found?
>

The interfaces tell the compiler how to compile a foreign function 
call (how many arguments a foreign function takes and what the types
of those arguments and the return value are.)

For foreign functions that're defined in the standard C library
(which is called libSystem on OSX and usually called libc belsewhere),
all you need to do in order to call the function is to have the
interfaces available: the standard C library is used by the lisp
itself and it's loaded every time the lisp starts up.

Other libraries may have to be explicitly opened (loaded into
memory) before the foreign functions that they define can be called.

? (open-shared-library "libcurl.dylib")
#<SHLIB libcurl.dylib #x300040F1CD5D>

(Note that I did that on an x86-64 Leopard system; many shared
libraries don't have 64-bit implementations on Tiger.)

If you attempt to call a foreign function (via #_) with the
wrong number of args, that error can be detected at compile-time
(actually, at macroexpand time.)

If you attempt to call a foreign function whose name can't be
mapped to an address, that error occurs at runtime.

If you call a foreign function with the right number/types of
args and the library which contains that foreign function
has been mapped into memory (allowing the function's name
to be mapped to an address), the foreign function should
do whatever it does and return whatever it returns.




More information about the Openmcl-devel mailing list