[Openmcl-devel] I rebuilt my cdb files...now what?
gb at clozure.com
Tue Nov 6 19:52:47 EST 2007
On Tue, 6 Nov 2007, R. Matthew Emerson wrote:
> On Nov 6, 2007, at 7:04 PM, Ron Garret wrote:
>> I then restarted CCL but none of the mysql definitions worked, e.g.:
>> ? #$MYSQL_OPT_CONNECT_TIMEOUT
>>> Error: Constant not found: X86-DARWIN64::MYSQL_OPT_CONNECT_TIMEOUT
>> MYSQL_OPT_CONNECT_TIMEOUT is an enum element. But nothing works.
>> Constants defined with #DEFINE aren't there. Functions aren't found
>> using #_ (though I can call them manually using the FFI so I know
>> they're loaded properly).
>> What am I missing?
> Maybe (use-interface-dir :mysql)?
At least, but there's another thing worth mentioning.
The C preprocessor allows things like:
#define X Y
#define Y 17
If the .ffi parser sees the FFI-ized versions of those definitions and
doesn't have .cdb files on hand, it won't be able to resolve the forward
reference to and won't define X; it will be able to define Y as 17 and
write that definition into the appropriate .cdb file.
(There's a similar issue with forward-referenced types.)
If the .ffi parser made a second pass (with access to the .cdb file), it
could resolve the forward reference to and would define X to be 17 as
It's therefore often necessary to run the ffi parser twice on a new
set of .ffi files.
? (ccl:create-interfaces :mysql) ; I HOPE it's exported
will do all of this for you (e.g., find the populate.sh script and run it,
and then run PARSE-STANDARD-FFI-FILES enough times.)
Once that's done, you do have to do:
to make those interfaces available (I don't remember, but the process
of parsing a given set of interfaces may have left them "in use").
Part of the rationale for requiring you to explicitly "use" a set of
interfaces is to minimize the possibility of name collisions. I don't
know if any of the names in (for instance) X11 conflict with anything
in some other C library/framework, but the odds are that something,
somewhere conflicts with something unrelated. Selecting which sets
of interfaces you want to access is supposed to offer at least some
coarse control over this.
(USE-INTERFACE-DIR should be documented; CREATE-INTERFACES is only
a few months old and isn't documented yet.)
More information about the Openmcl-devel