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

Re: Making MzScheme extensions using VC++ 5.0? (Success!)



Matthew -

Thanks for the additional suggestions. 

I just got it to work under VC 5.0 following something along the lines
of your suggestion.

I had noticed that "mzdyn.c" was included in
C:/plt/collects/mzscheme/lib directory. (I think I have just the
standard distribution.) 

I built a VC 5.0 project using the defaults to make that a static
library, included mzdyn.c, and then took the resulting mzdyn.obj file
and replaced the one in:
C:\PLT\collects\mzscheme\lib\win32\i386\msvc
(leaving the mzdyn.exp the way it was.)

I then ran mzc and after doing:
(load-extension "c:\\pdfscheme\\hello.dll")
Success -- I got "hello world".

So, this appears to work. I'll have to see if other problems pop up down
the line. (Perhaps there are special flags in "mkmzdyn.bat" regarding
threading etc.?).

For amusement, I used WinDiff to look at the two release object files
(5.0 and 6.). They are identical in size. They differ in blanks only in
the first few characters. Those Microsoft developers -- always keeping
us on our toes.

Thanks again for all your help.

By the way, the header file was still "escheme.h" so it must be
something else in the GCC case. I'm putting getting that to work aside
for now. And you're correct GCC doesn't have this problem by itself.
It's just that the runtime library of Cygwin is under the GPL, so using
it infects your program. These links are quite clear about that:
 
http://www.xraylith.wisc.edu/~khan/software/gnu-win32/x86-win32-ports.html
  http://sources.redhat.com/cygwin/licensing.html
As long as you use GCC without that runtime (and there are alternatives)
there are no GPL issues restricting the result that I know of. If
releases of MzScheme are ever compiled under GCC and use Cygwin you may
wish to evaluate this, as that would put MzScheme under the GPL (which
might limit interest in it in for some people, myself included). I'm
presuming here the released Windows build is done with VC 6.0 and uses
its runtime libraries? 

-Paul Fernhout
Kurtz-Fernhout Software 
=========================================================
Developers of custom software and educational simulations
Creators of the Garden with Insight(TM) garden simulator
http://www.kurtz-fernhout.com

Matthew Flatt wrote:
> 
> Quoting Paul Fernhout:
> > In poking around some more in DejaNews and Google, it does seem this is
> > a problem related to VC 6.0 changing the object file format so VC 5.0
> > can't link to it.
> 
> In that case, you might want to grab the MzScheme source distribution
> and rebuild mzdyn.o for VC 5. (The relevant script is
> plt/src/mzscheme/dynsrc/mkmzdyn.bat.)
> 
> > However, using mzc with gcc, I now get a different problem in the DLL
> > link: undefined reference to `scheme_make_string'
> 
> Perhaps, in the process of trying to make things work earlier, you
> changed #include "escheme.h" to #include "scheme.h" in "Hello.c", or
> made some change to the headers?
> 
> I ask because `scheme_make_string' really won't be defined. It will be
> macro-mapped to `scheme_extension_table->scheme_make_string' by
> "escheme.h". So whatever is going wrong, it looks like header problems
> and not linking problems.
> 
> > I noticed you referenced Cygwin. It is my understanding if I use that,
> > the related linked DLL code all falls under the GPL (not LGPL).
> 
> To be honest, I'm not sure. Certainly using gcc doesn't have this
> effect, but maybe there are issues with support DLLs for Cygwin.
> 
> Matthew