Discussion:
[omniORB] Need help creating C interface to omniORB application on a Windows machine
W T Meyer
2006-07-17 20:52:34 UTC
Permalink
I am using omniORB to salvage some legacy software developed on a
Windows machine using a National Instruments VME hardware interface
and LabWindows GUI to access VME hardware. The application is
written in C and must be compiled with NI's CVI compiler to get the
GUI interface. We have replaced the old NI hardware interface with a
single board computer running Linux and want to keep using the old
client software.

I have developed a DLL that replaces the client's calls to NI
routines (in C) with work-alike routines using omniORB. I must
compile the omniORB code with MSVC++ (version 6.0) and export it
using 'extern "C"' in order for the CVI compiler to link to it.

I had all of this working until I added the ability to transfer
arrays, which required adding _var variables. After that, the old
method of compiling on MSVC++ still gave a DLL and gave no error
messages, but neither CVI nor MSVC++ client programs were able to use
it - the DLL was somehow corrupted.

Following the advice in chapter 12 of the omniORB manual, I tried
adding '#define USE_stub_in_nt_dll' before including my stub headers
and this did not fix the problem.

Does anyone have any experience doing this, or any thoughts that
could be helpful?

Thanks,

Tom Meyer
Duncan Grisby
2006-07-27 15:53:38 UTC
Permalink
I have developed a DLL that replaces the client's calls to NI routines
(in C) with work-alike routines using omniORB. I must compile the
omniORB code with MSVC++ (version 6.0) and export it using 'extern
"C"' in order for the CVI compiler to link to it.
I had all of this working until I added the ability to transfer
arrays, which required adding _var variables. After that, the old
method of compiling on MSVC++ still gave a DLL and gave no error
messages, but neither CVI nor MSVC++ client programs were able to use
it - the DLL was somehow corrupted.
What exactly was the problem?
Following the advice in chapter 12 of the omniORB manual, I tried
adding '#define USE_stub_in_nt_dll' before including my stub headers
and this did not fix the problem.
I don't think that's relevant here -- I assume you're packaging all your
code that uses omniORB, including the generated stubs, into one single
DLL. In that case, you don't need to mess with the USE_stub_in_nt_dll
stuff.

DLLs on Windows are a total nightmare. Perhaps you are suffering from
the non-uniform memory model and allocating things in one DLL and
deallocating them in another. In that case, you need to make sure all
the DLLs are compiled with the same options, otherwise you get errors
when things are deallocated.

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Loading...