[Prev][Next][Index][Thread]
Re: FFI question #2: Getting the address of a C function
oodl@my-deja.com wrote:
[...]
> I'm trying to fill in a C struct with C function pointers. I want to do
> something like:
>
> callbacks.function-1 := address-of-c-function("foo");
This function cannot exist since such functionality is not part
of the C runtime.
> define c-address foo-pointer :: <c-function-pointer>
> c-name: "foo";
> end;
This works because it uses the linker to make sure the address of
foo is placed in a linkage entry.
[...]
>[...] I think
> that define c-address macro must use a function that does what I want,
> but I don't know how to get at it.
Nope.
Now part of what you want could be done in C by using dynamic loader
functionality (via dlsym() or shl_findsym() on HP-UX), and probably
in Dylan via the proper C-FFI binding, but it requires the function
to be exported from the library in the first place.
Regards - Eric
--
Eric Gouriou egouriou@cup.hp.com
Follow-Ups:
References: