<br><br><div><span class="gmail_quote">On 2/13/07, <b class="gmail_sendername">Marc Feeley</b> <<a href="mailto:feeley@iro.umontreal.ca">feeley@iro.umontreal.ca</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
-----BEGIN PGP SIGNED MESSAGE-----<br>Hash: SHA1<br><br>On 13-Feb-07, at 1:18 AM, James Long wrote:<br><br>> There's got to be something I'm missing, has anyone else gotten<br>> this to work? Or does anyone see anything wrong with how I'm
<br>> compiling the dll (the loading part is relatively simple and I<br>> doubt the problem is in there)?<br><br>Yes. What is missing is the *initialization* of the Gambit-C runtime<br>system (all the tables used by Gambit-C, the memory manager, the I/O
<br>subsystem, etc). This is done with a call to ___setup(...). The<br>initialization must happen before the first call to any function your<br>Scheme DLL is exporting. The best approach is probably to call<br>___setup(...) when the code is loaded (
i.e. the call ___setup(...)<br>should be in the DllMain function). It is good style to call<br>___cleanup() when the DLL is unloaded.<br><br>I've copied below the code that works for me. I'm using MinGW.<br>Small variations may be needed to the makefile for Cygwin and
<br>Microsoft's compiler.<br><br>Let me know if this works with .NET .<br><br>Marc<br><br><br></blockquote></div><br>Thanks, that worked great! Ah the benefits of compiling to C. brilliant.<br><br>Could you explain the LINKER macro, though? Or is there any documentation about this setup anywhere? I found a couple other emails about this but none of them really explained it. What is LINKER (defined as ____20_dll__ in mine, which supposedly works) supposed to represent?
<br><br>Also, what exactly does the D___DYNAMIC flag to gcc do, out of curiousity? I'm assuming it does things like tell gambit not to generate a main function, and possibly specify calling conventions and exporting attributes. Seems like it's mainly used to generate a dynamic library to be loaded by Gambit, though I think I need it in this situation as well. Gambit could use the same flag to generate that DllMain function, but I guess the focus is on a library for use with Gambit.
<br><br clear="all"><br>-- <br>James L