[plt-dev] MzCOM triggers error in salloc.c

From: Paul Steckler (steck at stecksoft.com)
Date: Sun May 23 18:44:05 EDT 2010

Thanks, I'll try that out.

-- Paul


On 5/23/10, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> I forgot to update MzCOM for a new requirement (to support futures) on
> embedding MzScheme into a Windows executable.
>
>
> I'll try this myself, but if you get to it first, try adding
>
>   static __declspec(thread) void *tls_space;
>
> to the MzCOM executable, and then put
>
>   scheme_register_tls_space(&tls_space, 0);
>
> before the call to scheme_main_setup() in evalLoop().
>
>
> At Sun, 23 May 2010 12:12:26 +1000, Paul Steckler wrote:
>> Erich Neuwirth had written to me that MzCOM from the latest PLT
>> release crashed for him, so I went off to investigate.  I hadn't run
>> MzCOM (or MysterX) in yonks (as they say here).
>>
>> I compiled MzCOM from sources using Visual Studio 2008, no issues
>> there.  I couldn't get MysterX (libmysterx)
>> to compile, though.  The thought was to load MzCOM into MysterX, but
>> it looked like a tough slog to fix the
>> compilation errors.  So instead, I decided to write a little C++
>> driver to load MzCOM.
>>
>> The driver compiled fine, but the Eval method in MzCOM just hung.  I
>> haven't yet looked into that.
>>
>> Next, I tried call the About method.  Indeed, I saw the About box --
>> but then MzCOM crashed.
>>
>> The crash is due to a write-to-NULL error around line 368 of salloc.c,
>> in this block:
>>
>>   # elif defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS)
>>     *scheme_get_thread_local_variables_ptr() = vars;
>>
>> Here's the driver program:
>>
>> #include "stdafx.h"
>> #include "mzcom.h"
>>
>> int _tmain(int argc, _TCHAR* argv[])
>> {
>> 	CLSID clsid;
>> 	IMzObj *pIMzObj;
>>
>> 	CoInitialize(NULL);
>>
>> 	CLSIDFromProgID(L"MzCOM.MzObj.4.2.5.0",&clsid);
>> 	CoCreateInstance(clsid,NULL,CLSCTX_SERVER,IID_IMzObj, (void
>> **)&pIMzObj);
>>
>> 	pIMzObj->About();
>>
>> 	return 0;
>> }
>>
>> It's a VS2008 project, and you need to add mzcom.h and mzcom_i.c from
>> the mzcom directory in
>> src/worksp.
>>
>> Any ideas?
>>
>> -- Paul
>> _________________________________________________
>>   For list-related administrative tasks:
>>   http://list.cs.brown.edu/mailman/listinfo/plt-dev
>


Posted on the dev mailing list.