adolgert
Forum Newbie
Posts: 0
|
Hi, I had a problem linking a loadable module in Windows. I linked my module with DXLite.lib and DXExec.lib on the link line. The linker picked up the standard DX file functions (DXAllocate, DXNewField, etc) from DXLite.lib, which links perfectly, but the resulting module makes DX crash in random modules later in the net. The cause for the crash is that the running DXExec.exe uses an internal version of standard DX file functions and msvcrt.dll as its C runtime, while the module was using its own set of those functions, and you can't always mix C runtimes. (Different versions of Visual Studio come with different C runtimes.) The solution is to use only DXExec.lib on the link line. I know this is review, but I got it mixed up, so I'll write it here, like detention at the chalkboard. For a standalone program manipulating DX data, use DXLite.lib. For a standalone program also executing DX modules, use DXCallm.lib. For a program talking to DX over DXLink, use DXL.lib. For a loadable module, use DXexec.lib. DXExec.lib, unlike the others, is just an import stub for dxexec.exe, meaning that your module, once compiled, will call DXAllocate and other functions in DXExec.exe, itself. This is good news on Windows because it means that your code will use the same C runtime as DXexec.exe in the places where it needs to use the same runtime. The current version of DX allows you to run either the regular X-windows dxexec.exe or a native Windows dxexec.exe. If you set DX to use the native Windows exec, then you should compile against dxexec-native.lib instead of dxexec.lib. The only difference is a few X and Windows functions: <DXDisplayX <DXDisplayX12 <DXDisplayX24 <DXDisplayX4 <DXDisplayX8 <DXCatchWinopenErrors <__dxfCreateWindow <__dxfProcessEvents <__dxfSetXError <__dxfXErrorHandler >DXInitializeWindows >DXMain I don't see the in the html help files the difference between DX.lib and DXCallm.lib, so I don't know when to prefer one over the other, but the symbol tables show the following differences: --DX.lib <DXCacheDelete <DXCacheInsert <DXCacheInsertObject <DXCacheSearch <DXCompareModuleId <DXCopyModuleId <DXDeleteTaskGroup <DXExecuteTaskGroupNoWait <DXGetIntVariable <DXGetModuleCacheStr <DXGetModuleCacheStrLen <DXGetModuleComponentName <DXGetModulePath <DXGetModulePathLen <DXGetVariable <DXLoadMDFFile <DXLoadMDFString <DXLoopDone <DXLoopFirst <DXOutboard <DXPrintCurrentModule <DXRegisterCallbackHandler <DXSaveForId <DXSetIntVariable <DXSetVariable <DXWinFork <DXMain <__dxf_ExReadXRCFiles <_m_DXLInputNamed <_m_SetDXLInputNamed --DXCallm.lib >DXInitModules >DXInitializeXMainLoop >DXInputAvailable >DXqwrite >DXsqmessage >DXSetOutputs >DXPrintMemoryInfo >DXSetOutputs >DXIsInputAvailable >DXFreeInputs >DXCallOutboard >DXCheckRIH >DXCompareModuleMacroBase >DXGetInputs Drew Dolgert Cornell Theory Center
|