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: Matt Birkholz
Subject: Re: [MIT-Scheme-devel] FFI and KyotoCabinet
Date: Mon, 28 Mar 2011 11:02:30 -0700

> From: Peter Feigl <address@hidden>
> Date: Mon, 28 Mar 2011 09:02:52 +0200
> 
> [...]
> 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.

It could be compiled separately and included in the link.  From my Gtk's
Makefile-fragment:

        gtk-shim.so: gtk-shim.o scmwidget.o gtkio.o
                $(LINK_SHIM) $^ `pkg-config --libs gtk+-2.0`

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

No microcode hackery is needed.  Just generalize alien-function (and
alien-function-cache!), renaming them alien-symbol- or sump'n.  Most
of the caching process will be the same for both -functions and
-variables (i.e. dld-find/load-library, then dld-lookup-symbol).

I see a declaration is not strictly needed.  If we have code like
this:

        (c-variable "foo_bar")

we can generate code like this:

        (get-address #[alien-symbol 42 foo_bar])

and we're done (unless you REALLY like type-checking).

> > Are you party to an employment contract?
> 
> Yes, though I wrote this code in my free time (I work with C#/C++,
> unfortunately).

Is it difficult to get a disclaimer from your employer per these
recommendations?

        http://www.gnu.org/licenses/why-assign.html

If you assign your copyright to MIT, you simplify (strengthen) the
copyright status of all of the code.

Sometimes I see this project take pains to keep a clear copyright
registration... and sometimes not... so I hesitate to ask you to do
this... mumble.

> If I want it to be automatically built and available,
> INSTALLED_SUBDIRS is the only option, right?

Probably not.  Just the easiest?

> I've managed to avoid autotools so far, seems now is the time to
> learn ;)

I have some hacks for src/Makefile.in and friends.  They arrange to
build FFIs *after* build-bands, to ensure that the compiled FFI syntax
and shim are consistent.  They artlessly snag some of the C
compilation and linking configuration from src/microcode/configure.ac;
that is how I was able to say $(LINK_SHIM) above.  They were tested by
building Gtk for x86_64 and portable C on portable C *or* native
hosts.  I will commit them to master forthwith -- i.e. sometime in the
next fortnight. :-)



reply via email to

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