chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] How to statically compile in an extension?


From: Felix
Subject: Re: [Chicken-users] How to statically compile in an extension?
Date: Sun, 26 May 2013 00:43:50 +0200 (CEST)

From: Eric Dong <address@hidden>
Subject: [Chicken-users] How to statically compile in an extension?
Date: Sat, 25 May 2013 12:13:18 -0400

> Hi there,
> 
> I'm constantly seeing references to "statically compiling an extension" but
> I can't find any reference on how exactly to do that. My usage case is I
> want to distribute an executable completely independent of Chicken
> libraries *and* the matchable extension, which is weird since even though
> it simply implements macros, it still gets loaded as an .so in the compiled
> code.

If you do 

  (import matchable)

instead of

  (use matchable)

then it will only be used at compile time, without adding a runtime
dependency. This works for all eggs that just provide syntax or do
only compile-time operations (like "bind", for example).

> 
> How would I do this? This is pretty necessary for my usage case since a big
> folder full of .sos and a shell script wrapper isn't exactly elegant...

Unfortunately this has to be handled by the .setup scripts. If the
number of eggs you need is limited, you can, in the worst case, try to
use modified setup scripts that compile to ".o" files, and link them
to your executable. Note that you have to use "(declare (uses ...))"
instead of "require-extension"/"use" to make the extension code (more
specifically, the runtime part) available to your application.

This is somewhat tedious, sorry.


cheers,
felix



reply via email to

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