[plt-scheme] Accessing modules in a stand-alone executable

From: Ulf Leopold (ulfleopold at yahoo.com)
Date: Sun May 11 17:47:24 EDT 2003

David, I'm of aware of separately compiled modules
like you mention. But that leaves the application
"spread out" into several files.

In order to avoid that, what I have been doing is to
compile the module file using the function
"compile-extension-parts-to-c" in the compiler
collection. I then compile the resulting .c file with
gcc. Then use "link-extension-parts" to produce a
_loader.so file that I link with my application. This
way all code gets located in a single executable file.

But, from what I understand, once a module is linked
with the application, _loader.so automatically loads
it. So in order to use it you have to use a require
statement on the form: (require mymodule).

Regards,

Ulf


--- David Van Horn <dvanhorn at cs.uvm.edu> wrote:
> 
> If you compile a module like this:
> 
>    cd mycollection
>    mzc --auto-dir mymodule.ss
>    MzScheme compiler (mzc) version 204, Copyright
> (c) 1996-2003 PLT
>    "mymodule.ss":
>      [output to
> "./compiled/native/i386-linux/mymodule.so"]
> 
> Then any program using mymodule needs only to state:
> 
>    (require (lib "mymodule.ss" "mycollection"))
> 
> The native code will be used unless the source code
> has been modified since
> compilation time, in which case the source code will
> be used instead.
> 
> Does that help?
> 
> -d
> 
> 

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com


Posted on the users mailing list.