From: Juan Jose Garcia-Ripoll <lisp@ar...> - 2006-07-08 08:12:38
2006/7/8, Dave Roberts <dave@...>:
> Sorry to bug you, but I have another one. What do I put in the module
> field of DEFINE-FOREIGN-VAR to make it happy? I'm trying to define errno
> as a foreign variable and ECL is barking at me. I tried:
> > (def-foreign-var ("errno" *errno*) :int "libc")
> LOAD-FOREIGN-MODULE: Could not load foreign module "libc" (Error: "libc:
> cannot open shared object file: No such file or directory")
> Broken at SI:FIND-FOREIGN-SYMBOL.
The module field contains the name of a library in which the symbol is
to be found. If you specify it, it has to be found by the dll opener.
In the case of the C library, since it is already loaded you do not
need it. Hence
> > (def-foreign-var ("errno" *errno*) :int "")
However, defining "errno" as a variable is highly non portable. You
should define a function that reads or sets this value, since "errno"
is a macro in any C specification you will find out there.