mit-scheme-devel
[Top][All Lists]
Advanced

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

Re: [MIT-Scheme-devel] FFI and KyotoCabinet


From: Peter Feigl
Subject: Re: [MIT-Scheme-devel] FFI and KyotoCabinet
Date: Mon, 28 Mar 2011 09:02:52 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Mar 27, 2011 at 04:16:56PM -0700, Matt Birkholz wrote:
> > - Is there a way to include extern variables? For example, I have the
> >   following declaration in the header file:
> >   <extern const char* const KCVERSION;>
> >   Right now, I include it as an enum, but it would be great if I could
> >   somehow correctly access this value.
> 
> Yes -- a quick way.  Add this helper function to your shim:
> 
>       const char *
>       kcget_version (void)
>       {
>         return (KCVERSION);
>       }

I wanted to avoid adding code to an auto-generated file. Is there a
way to add this C-code (as a string) to the cdecl file? It could just
be copied verbatim to the generated shim.c.

> A higher performance way: a new syntax, like C-callback, to memoize
> the result of a call to dld-lookup-symbol.  The memoized alien can
> then be used directly by c-peek- primitives, no fancy stack-sealing
> trampolines necessary.  Thus we might write this:
> 
>       (c-peek-cstringp (C-variable "KCVERSION") 0)
> 
> I'll leave the actual implementation (esp. the cdecl syntax) as a
> problem for someone who really WANTS it. :-)

I'll look into it ;) If it doesn't involve adding new microcode, I'll
probably manage.

> Are you party to an employment contract?

Yes, though I wrote this code in my free time (I work with C#/C++,
unfortunately).

> Do you intend this to be one of the INSTALLED_SUBDIRS?  If you just
> want a spot in src/, like src/swat/, that should be no problem (except
> perhaps the copyright).  If you expect to be one of the
> INSTALLED_SUBDIRS, you will want to play nice with the whole
> ./Setup.sh, ./configure, make, make install, make maintainer-clean
> cycle.  My Gtk interface, for example, implements options
> --without-gtk and --with-gtk, and auto-selection via pkg-config.

If I want it to be automatically built and available,
INSTALLED_SUBDIRS is the only option, right? I've managed to avoid
autotools so far, seems now is the time to learn ;)

Thanks for the help!

Peter

Attachment: pgpiYNEFCe7Be.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]