[Prev][Next][Index][Thread]

Re: FFI question #2: Getting the address of a C function



oodl@my-deja.com writes:

> My hunch is that the FFI has the functionality I am describing, but it
> is not documented.  But I could very well be wrong.  What does the
> "define c-function" macro expand to?

Although I haven't tried any of it, look at the source code for
x86-win32-operating-system.dylan in the sources/lib/operating-system
directory. There you will see code like:

  %call-c-function ("GetVersionExA", c-modifiers: "__stdcall")
    (lpOSVersionInfo :: <raw-c-pointer>) => (success? :: <raw-c-signed-int>)
	(primitive-cast-raw-as-pointer(primitive-string-as-raw(buffer)))

Perhaps you can work out how to call these functions. Possible in the
dylan-direct-c-ffi library. Searching this library using the browser
might highlight other useful functions.

Let me know if you get it going as I'd be interested.

Cheers,
Chris.
-- 
http://www.double.co.nz/dylan



References: