I'm working on a huge project porting hundreds of V8i MA applications into native C++ code. I guess I'm gonna post lots of questions on this forum.
I start with this one:
From within an application, defined in DLL one, we call a function foo that is defined in DLL two.
This foo function opens a Dialog that is defined in the .r file that is linked with the second DLL, however, I get error "Unable to load dialog from 'DLL-ONE' whose id is 1001002".
The original code resolved this as follows:
void foo(int param1, const char* param2)
{
if (strcmpi(mdlSystem_getCurrTaskID(), "NAME_DLL_2") != 0) { mdlDialog_callFunction(mdlSystem_findMdlDesc("NAME_DLL_2"), foo, param1, param2); return; }
...
mdlDialog_openModal(&lastAction, NULL, 1001002);
}
How can we resolve this in native C++ code now that mdlDialog_callFunction is no longer supported?
I tried the following:
RscFileHandle rsc_handle; StatusInt status; status = mdlResource_openFile(&rsc_handle, "NAME_DLL_2", RSC_READWRITE);
mdlDialog_openModal(&lastAction, rsc_handle, 1001002);
But this returns status 32768 when opening the resource file.
Thanks,
Robert Kock
Hi Robert Kock,
In MicroStation V8 (and later) native code calling mdlDialog_callFunction() becomes redundant where standard Microsoft function decoration and calling conventions should be preferred and applied; like using DLL import/export decorations and library compilation rules. e.g. See: Importing function calls using __declspec(dllimport). Also (if/as) needed, standard C/C++ conventions for dereferencing (event) function callbacks could for your own applicatoin event and communication needs where you dereference the (reachable) function name and pass any required arguments.
HTH,Bob