Exportable class functions as stand alone functions to .DLL or .SO

T

Timothy Wong

Hi,

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).
 
J

Jeff Schwab

Timothy said:
Hi,

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.
 
R

Rolf Magnus

Timothy said:
Hi,

Here is my situation...please tell me if this is possible:

It might be, but not in standard C++, which has no means to load
additional executable code at runtime. You'd have to ask in a newsgroup
about your platform.
 
T

Timothy Wong

Jeff Schwab said:
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.


I am unable to grab any header file. The situation I was explaining
is a more generic situation than what I am in. Let's say your
application was netscape, mozilla, or a 3rd party application.

I do realize I can use global functions to wrap around the class based
implemenations, but that alternative is something last resort.

FYI to everyone, this is a MS Visual C++ 6.0 application.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top