odinitialize() causes runtime error
odinitialize() causes runtime error
hello
it might well be, that my topic doesn't belong in this forum... but maybe you can share some dwgdirect c++ wisdom/experience with me and point me to the right direction.
i've built an activex control using vs9 with a rather simple interface. my dll links to your dwgdirect libraries (vc9md). the control is kept quite simple. every call to an interface-function initializes dwgdirect, does what it is intended to do, uninitializes dwgdirect and returns (sample code). on the other hand i have a console-application called tester, which calls the registered activex controll (my dll). this application is also built in vs9. so both my dll and the tester depend on msvcr90.dll, as do the dwgdirect dlls (msvcr90.dll, msvcp90.dll).
sample code:
code:
stdmethodimp cdxfmerge::determinedimension(bstr dxfdrawing, double* height, double* width, long* returncode)
{
odstaticrxobject<myservices> svcs;
odinitialize(&svcs);
odgsinitialize();
{ //scope for smartpointers
int rcode = rc::r_odread;
try{
oddbdatabaseptr pdb = svcs.readfile( dxfdrawing, false, false, oda::ksharedenyno );
double h = 0;
double w = 0;
rcode = commonfunctions::calculatedimension( pdb, h, w );
*height = h;
*width = w;
} catch( oderror e ){
odstring s = e.description();
odresult r = e.code();
}
*returncode = rcode;
} //scope for smartpointers
odgsuninitialize();
oduninitialize();
return s_ok;
}when i run that tester console-application, everything works fine. i open, edit and write dxf-files with no problems at all. so far, so good.
however, if i build another console-application (very same code) in vs8 and then make calls to my dll, i get following error: r6034 an application has made an attempt to load the c runtime library incorrectly.
this error occurs, as soon as i use dwgdirect functionality inside my dll(i.e. odinitialize()).
what could be the reason for this? do i have to use other library types, which ones?
thanks in advance for your help!
martin
----------------------------
additional info:
compiler-settings:
code:
/od /i "d:\classcad_addons\opendesign\2.06\include" /i "d:\classcad_addons\opendesign\2.06\include\ge" /i "..\dwgdirect\exservices" /i "d:\classcad_addons\opendesign\2.06\include\gs" /i "..\dwgdirect\common" /i "..\dwgdirect\bmpexport" /i "d:\classcad_addons\xerces\2.8\include" /i "d:\classcad_addons\cximage\599c\cximage" /d "win32" /d "_windows" /d "ndebug" /d "_usrdll" /d "_toolkit_in_dll_" /d "_windll" /d "_atl_dll" /d "_unicode" /d "unicode" /fd /ehsc /md /fo"release\\" /fd"release\vc90.pdb" /w3 /nologo /c /zi /tp /errorreport

romptthe linker-settings:
code:
/out:"d:\myproject\\bin\release\merge.dll" /incremental:no /nologo /libpath:"d:\classcad_addons\opendesign\2.06\lib\vc9md" /libpath:"d:\classcad_addons\xerces\2.8\vc9\lib\release" /libpath:"d:\classcad_addons\cximage\599c\cximage\cximagedll\release" /dll /manifest /manifestfile:"release\merge.dll.intermediate.manifest" /manifestuac:"level='asinvoker' uiaccess='false'" /def:".\merge.def" /subsystem:windows /opt:ref /opt:icf /dynamicbase /nxcompat /machine:x86 /errorreport

rompt dd_vc9md_jpeg.lib dd_gs_dll.lib dd_db_dll.lib dd_dbroot_dll.lib dd_ge_dll.lib dd_root_dll.lib dd_acisbuilder_dll.lib dd_gi_dll.lib dd_alloc_dll.lib dd_key.lib xerces-c_2.lib cximagecrt.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
this is probably a manifest problem.
to make sure - add to the vc8 console application manifest references to vc9 runtime.
vladimir
i did as you proposed and it worked!
thanks for the rather fast reply!
martin
fighting the dll hell, ms seem to have produced a manifest one

vladimir