[omniORB] Exception during bindObjectToName

Sai-Lai Lo S.Lo@orl.co.uk
02 Sep 1998 11:52:20 +0100


If I understand your setup correctly, you have packaged some omniORB2 stub
generated by omniidl2 and your application code into a DLL. A call from a
GUI into the DLL results in an exception.

I suggest you first look into how you built the DLL. 

This may not be known to most users. For the stub code to be packaged into
a win32 DLL, it has to be compiled differently. I wrote the following note
in <omniorb root>/include/omniORB2/CORBA_sysdep.h:

// _OMNIORB2_DLL is defined when the omniORB2 dll is compiled.
// _WINSTATIC    is defined when an application is compiled to use the
//               static library.
//
// To package stubs into dlls:
//   1. Make sure that the cpp macro USE_stub_in_nt_dll is defined before
//      the stub header (.hh) is included.
//   2. Define the cpp macro _OMNIORB2_STUB_DLL when the stub _SK.cc is
//      compiled.
//   3. A .def file has to be created to export the symbols in the dll.
//      The .def file can be generated automatically based on the output
//      of dumpbin. For an example, look at how the omniORB2 dll is created.
//
// To use stubs that has been packaged into dlls:
//   1. Make sure that the cpp macro USE_stub_in_nt_dll is defined before
//      the stub header (.hh) is included.
//
// Use _OMNIORB_NTDLL_IMPORT to ensure that MSVC++ use the correct linkage
// for constants and variables exported by a DLL.

Hope this helps with your problem.

Sai-Lai


>>>>> Andreas Hennig writes:

> Hi everybody, I've got a problem ...
> Config:
>  OmniORB 2.6 (i.e. 2.5+snapshot_980827_x86_win32) (2.5 had same problem)

>  WinNT 4.0

> System:
>  we have a DLL, which - in order to get a handle that seems to be
> necessary - is hosted by a simple Win GUI application. The CORBA server
> uses this DLL, so we packed it into the WIN Appl, started by a special
> button and the GUI, which calls a function (almost) identiacal to main
> in the examples.

> Problem:
>  All's fine until we try to bind the object to a name (bindObjectToName
> in the examples).
> in the statement
>  try {
>       // Bind the context to root, and assign testContext to it:
>       testContext = rootContext->bind_new_context(contextName);
>     }
> sometimes also a little later in
>     // Bind obj with name Echo to the testContext:
>     try {
testContext-> bind(objectName,obj);
>     }
> an exception is thrown:
> First-chance exception in Agent.exe (OMNIORB260_RT.DLL): 0xC0000005:
> Access Violation.
> First-chance exception in Agent.exe (KERNEL32.DLL): 0xE06D7363:
> Microsoft C++ Exception.

> We think, the reason for this is probably a bug somewhere deep in a
> DLL.  We thought the windows event-loop might interfere with the CORBA
> listening, so we put them into different threads, no result.

> Question:
>  Did anyone have a similar problem and maybe even managed to solve it?
>  I don't particularly like the idea of the GUI hanging around just to
> make windows/the DLL insisting on a handle happy - any suggestions (or
> statements of sympathy)?


-- 
Dr. Sai-Lai Lo                          |       Research Scientist
                                        |
E-mail:         S.Lo@orl.co.uk          |       Olivetti & Oracle Research Lab
                                        |       24a Trumpington Street
Tel:            +44 223 343000          |       Cambridge CB2 1QA
Fax:            +44 223 313542          |       ENGLAND