[racket] CGC embedding on win64

From: ugo (gogo1969 at gmail.com)
Date: Tue Jan 4 08:44:11 EST 2011

 > You should be able to build the DLLs using MSVC and selecting the
 > "Debug" project. But that actually just turns off optimization;
 > debugging ".pdb" files are generated with the "Release" build.
 >
 > I'm not sure why the debugger wants "sgc.lib", since that's used only
 > for the "SGC" project. Try building the "SGC" project, and then
 > re-build the "Release" project, and maybe that will make the debugger
 > happy.

I had a problem with a missing (..\) include path in the debug version 
of sgc.lib, I haven't checked yet the latest git branch but I might have 
messed up the .sln myself while creating the x64 configurations.

 > But are you calling scheme_basic_env() directly? Normally you should
 > use scheme_main_setup() or scheme_main_stack_setup(), which sets GC
 > and thread parameters before calling scheme_basic_env().

I am actually calling scheme_set_stack_base().

The issue is: I am adding a racket interpreter to a GUI (Qt) application 
and I cannot simply call scheme_main_setup() and run a REP loop from 
within a function passed to scheme_main_setup(). I basically need to 
create/initialize an interpreter at initialization and then evaluate 
expressions at a later time.
I now have something that seems to work but no idea if it's the right 
approach (probably not, and apparently I cannot use it with 3m);

something like:

Scheme_Env* Init()
{
   ...
   int dummy;
   scheme_set_stack_base( &dummy, 1 );
   Scheme_Env* e = scheme_basic_env();
   ...
   scheme_namespace_require(scheme_intern_symbol("scheme/base"));
   ...
   return e;
}

Thanks

-ugo-







On 1/3/2011 4:08 PM, Matthew Flatt wrote:
> At Mon, 03 Jan 2011 10:25:25 +0100, ugo wrote:
>> Thanks a lot!
>>
>> I was able to make the racket embedding code work...
>>
>> ...but now I have another problem: When I try to call scheme_basic_env()
>> the program crashes with an access violation error (reading location 0x0
>> so it's probably due to a NULL pointer).
>> I cannot perform any further debugging because I was not able to build
>> racket in debug mode, I tried to build debug versions of the libraries
>> but Visual Studio reports a missing .\debug\sgc.lib file.
>>
>> Is there a way to build everything in debug mode ?
>>
>> (running on Windows 7 64bit/VS2008)
>
> You should be able to build the DLLs using MSVC and selecting the
> "Debug" project. But that actually just turns off optimization;
> debugging ".pdb" files are generated with the "Release" build.
>
> I'm not sure why he debugger wants "sgc.lib", since that's used only
> for the "SGC" project. Try building the "SGC" project, and then
> re-build the "Release" project, and maybe that will make the debugger
> happy.
>
>
> But are you calling scheme_basic_env() directly? Normally you should
> use scheme_main_setup() or scheme_main_stack_setup(), which sets GC and
> thread parameters before calling scheme_basic_env().
>




Posted on the users mailing list.