[plt-scheme] mzc embedding question

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Fri Nov 30 13:18:51 EST 2007

Sorry for the confusing. I didn't read carefully, and replied based on 
vague memory.

Using command line under Windows, here's some old script I used:

call "%VS80COMNTOOLS%vsvars32.bat" x86
SET CL=/nologo /c /DWIN32 /D_WINDOWS /W3 /ML /O2 /DNDEBUG /I"C:\Program 
/LIBPATH:"C:\Program Files\PLT\lib\msvc"
CL yourfile.c
LINK yourfile.obj libmzsch370_000.lib libmzgc370_000.lib /OUT:yourfile.exe

You can also set everything up in MS Visual Studio. The only thing you 
need to do is to add the two file "libmzsch370_000.lib" & 

"Project" menu, "you_project_name Properties", "Configuration 
Properties", "Linker", "Input", "Additional Dependicies",

Put the two lib file names there should work.


Matthew Flatt wrote:
> At Fri, 30 Nov 2007 10:32:54 -0700, Chongkai Zhu wrote:
>> Matthew Padilla wrote:
>>> Hello,
>>> I would like to compile a C++ program that embeds MzScheme, similar to 
>>> the example given in the online documentation (see example at end of 
>>> email).  I would like to be able to pass it
>>> strings representing arbitrary Scheme programs, and have it evaluate them.
>>> I am running Microsoft's Visual C++ Express, on a Vista machine. 
>>> Am I mistaken, or can I use mzc for this purpose?  It seems as though 
>>> mzc makes life easier by resolving linkage issues, etc. (e.g. to 
>>> MzScheme libraries) but I'm not sure if this is only for
>>> extension writing.  I've managed to produce .obj files via mzc... but 
>>> not an .exe.
>> Sure you can.
>> mzc --cc yourfile.c
>> mzc --ld yourfile.exe yourfile.obj
>> should work.
> Actually, I don't think this works. `mzc --ld' is set up for linking
> shared objects that are loaded as extensions.
> I don't think `mzc' is going to be much help for creating embedding
> executables. It tries to use all the right compiler/linker flags for
> creating extensions, which are usually not the right flags for creating
> embeddings.
> Matthew

Posted on the users mailing list.