[omniORB] Windows DLL from stubs/skeleton files?

Renzo Tomaselli renzo.tomaselli@tecnotp.it
Fri Jul 19 14:02:02 2002


Lars,
    we did it as shown in the example project I sent you directly to avoid
annoying the entire list.
To anyone interested: there are a few hints to care about:

- if skeletons to pack into a dll include others, special care must be taken
to avoid any import/export mismatch.
In short, if we are packing "foo" which includes "bar1", ..., "barN", we
create a couple of wrapper source files, e.g.

// core.cpp
#define USE_core_stub_in_nt_dll
#define USE_dyn_stub_in_nt_dll
#define USE_core_stub_in_nt_dll_NOT_DEFINED_BarN
#define USE_dyn_stub_in_nt_dll_NOT_DEFINED_BarN
#include "FooSK.cpp"

// dyn.cpp
#define USE_core_stub_in_nt_dll
#define USE_dyn_stub_in_nt_dll
#define USE_core_stub_in_nt_dll_NOT_DEFINED_BarN
#define USE_dyn_stub_in_nt_dll_NOT_DEFINED_BarN
#include "FooDynSK.cpp"

inclusion order in foo.hh matters ! This is specially annoying since there
are tools like Rational Rose which yield idl files where inclusion order
seems to be random. Then Omniidl follows this order to generate its .hh.

- then we do a special .def processing by adding a Pre-link step to the dsp:

dumpbin /SYMBOLS $(IntDir)\*.obj | exp2def | sort /r | unique >
$(IntDir)\$(TargetName).def

which makes a def file out of all objs through a simple home-made tool
exp2def.exe. All public symbols are exported.

- we found very convenient to include versioning control by adding to the
idl a couple of constants, such as VERSION_MAJOR/MINOR. Then add a check
function to core.cpp:

namespace Foo {
 bool checkVersion(int major, int minor) {
  return major == VERSION_MAJOR && minor == VERSION_MINOR;
 }
};

This way any linking dll/exe can check at runtime that the model version it
knows about from foo.hh matches the runtime-provided foosk.dll.
Hope it helps,
                                             Renzo Tomaselli
---------------------------------------------------------------------------
TecnoTP s.n.c. Special Information System Design
Maso Pelauchi I38050 Ronchi Valsugana,  Trento TN  ITALY
e-mail: renzo.tomaselli@tecnotp.it
---------------------------------------------------------------------------



----- Original Message -----
From: "Lars von Wedel" <vonWedel@lfpt.rwth-aachen.de>
To: <omniorb-list@realvnc.com>
Sent: venerd́ 19 luglio 2002 09:31
Subject: [omniORB] Windows DLL from stubs/skeleton files?


> Hi,
>
> I know there have been numerous posts on this list on how
> to generate a Windows DLL from the stubs/skeletons generated
> by omniidl. However, it seems there is no search engine to
> the mailing list anymore!?
>
> I have some rather basic questions:
>
>  i) Are the approaches to use a .def file and to
>     use the DLL export macros within the IDL files
>     alternatives or must they be used together?
>
> ii) I tried to extract the symbols from the DLL
>     via dumbin.exe. However, there seemed to be
>     symbols missing and the linker complains about
>     several symbols extracted. I have no clue which
>     symbols to remove and where to get the missing
>     ones from!?
>
> Any help is appreciated,
>
> Lars