[ODE] tri-collider + DLL

Pierre Terdiman p.terdiman at wanadoo.fr
Thu Jun 27 06:11:02 2002


Most of the time I just use something like this:

#define EXPORTED_FUNCTION   extern "C" __declspec(dllexport)

Then in the cpp, for ex in a MAX plug :

EXPORTED_FUNCTION int LibNumberClasses()
{
    // Returns the number of plug-ins in this DLL.
    return 3;
}

This is enough to export a function correctly. No need for DEF files.
The "extern "C"" part makes sure exported names are not decorated.

Only drawback is it's limited to C-functions, so you can't export
polymorphic functions this way. Ex, this failes:

EXPORTED_FUNCTION void DoSomeStuff ( int data )    {}
EXPORTED_FUNCTION void DoSomeStuff ( float data )    {}

For classes, you only need the "__declspec(dllexport)" part (exported names
are ok).

Pierre

----- Original Message -----
From: <nlin@nlin.net>
To: <ode@q12.org>
Sent: Thursday 27 June 2002 16:43
Subject: [ODE] tri-collider + DLL


> To use tri-collider with the msvc-dll configuration, you have to add
> a few new exports to the config/msvcdefs.def file, because the
tri-collider
> uses functions not exported in the current msvcdefs.def. You need to
> add:
>
> dGeomGetClassData
> dSpaceAdd
> dCreateGeom
> dCreateGeomClass
> dInfiniteAABB
> ?_freeAll@dArrayBase@@IAEXH@Z
> ?dCollideBP@@YAHPBUdxGeom@@0HPAUdContactGeom@@H@Z
> ?_setSize@dArrayBase@@IAEXHH@Z
>
> The last three entries are rather troubling, since they are C++ mangled
> names (MSVC calls these "decorated" names). I have no idea about how
> MSVC generates these names, if they change according to build settings,
> or if they change from version to version of MSVC: You could probably
> also use __dllexport and __dllimport in the ODE code itself to
> take care of that, but then you need to #ifdef such declarations
> so that the code still compiles on other, standards-conforming C++
> compilers. It's probably possible to make a DLL without the .DEF exports
> list, but I don't have the time to investigate it right now.
>
> Also I've updated the tri-collider wiki page with some new notes.
> If you see anything which needs improving, jump right in and do it.
>
> -Norman
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode