Jonas Wissting <wiss@eelwing.arda> wrote:
+---------------
| rpw3@rigden.engr.sgi.com (Rob Warnock) writes:
| > Plus, every implementation of Scheme that I know of makes it almost
| > *trivial* to link in your own libraries of C code, often at runtime,
|
| How do I do this in mzscheme? I have browsed the manual but have not
| found anything.
+---------------
Ahhh... probably the wrong manual. You won't find it in the "PLT MzScheme:
Language Reference Manual" <URL:http://www.cs.rice.edu/CS/PLT/packages/
doc/mzscheme/index.htm>, but you *will* find it right at the top of the
"Inside PLT MzScheme" manual <URL:http://www.cs.rice.edu/CS/PLT/packages/
doc/insidemz/index.htm>, specifically:
<URL:http://www.cs.rice.edu/CS/PLT/packages/doc/insidemz/node5.htm>
Writing MzScheme Extensions
To write a C/C++-based extension for MzScheme, follow these steps:
...
There's a recipe for compiling a shared library, including required entry
points. Once you've compiled it, you can link it in to MzScheme at runtime
with (load-extension "foo.so") [or "foo.dll", I guess, on Windows].
I use MzScheme "extensions" all the time. Very handy...
-Rob
p.s. You'll probably need to read at least some of the other sections,
too, in order to see how to access & create MzScheme objects, call Scheme
code from C code, etc.
-----
Rob Warnock, 31-2-510 rpw3@sgi.com
Network Engineering http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673
1600 Amphitheatre Pkwy. PP-ASEL-IA
Mountain View, CA 94043