Re: Exportable class functions as stand alone functions to .DLL or .SO
From: Jeff Schwab (jeffplus_at_comcast.net)
Date: Wed, 19 May 2004 11:24:26 -0400
Timothy Wong wrote:
> Here is my situation...please tell me if this is possible:
> 1) An existing application loads a DLL or SO and is looking for a
> function (e.g. - getName(void))
> 2) Prior DLL's that were created in a procedural fashion and just
> created a global function.
> 3) Now I want to create a class to encapsulate this function and
> create a DLL or SO
> My question ... is it possible to compile a DLL in this way and
> have the old application be able to load getName with out any notion
> of loading/instatiating a class? The dilemna here is that the
> application cannot be modified (no source code).
You could use a "bridge" module to implement the old interface using the
new. That is, use the same header file that was included when the
original application was compiled. Replace the implementation file with
one implementing the global functions by simply wrapping your new,
class-based implementation, possibly in a different dll|so.