[gambit-list] Creating dynamically-loadable libraries
mikel evins
mevins at me.com
Wed Mar 6 08:45:14 EST 2019
> On Mar 6, 2019, at 7:40 AM, Marc Feeley <feeley at iro.umontreal.ca> wrote:
>
> Have you looked at the files client.c, server.h and server.scm in the tests directory?
>
> You can embed Gambit in this way and then from C do:
>
> eval_string("(load \"lib.o1\")");
I haven't; thank you. I'll take a look.
In case it doesn't work out conveniently, or in case anyone else asks for another approach, I did find another way to accomplish the same purpose: I used Xcode to build a dynamic library that linked against a static library that I built with Gambit. In the dylib project I added a C source file that exposed an init function that performs the Gambit startup.
I then loaded it at runtime in a Lispworks image, executed the init, and then tested a few of the simpler library functions; they returned the expected values.
I haven't dealt with unloading the library (in part because I don't expect ever to do that), so my tests didn't execute Gambit's cleanup. Are there bad consequences I should be aware of from being sloppy like that?
Thanks for your kind attention.
More information about the Gambit-list
mailing list