[Ecls-list] UFFI errno?

Juan Jose Garcia-Ripoll lisp at arrakis.es
Sat Jul 8 08:12:36 UTC 2006


2006/7/8, Dave Roberts <dave at vyatta.com>:
> 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 "")
> *ERRNO*

this works.

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.

Jj




More information about the ecl-devel mailing list