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

Discussion in 'C++' started by Timothy Wong, May 19, 2004.

  1. Timothy Wong

    Timothy Wong Guest

    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).
     
    Timothy Wong, May 19, 2004
    #1
    1. Advertising

  2. Timothy Wong

    Jeff Schwab Guest

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

    Timothy Wong wrote:
    > 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.
     
    Jeff Schwab, May 19, 2004
    #2
    1. Advertising

  3. Timothy Wong

    Rolf Magnus Guest

    Timothy Wong wrote:

    > 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.
     
    Rolf Magnus, May 19, 2004
    #3
  4. Timothy Wong

    Timothy Wong Guest

    Jeff Schwab <> wrote in message news:<>...
    > Timothy Wong wrote:
    > > 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.



    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.
     
    Timothy Wong, May 20, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Punya Narra
    Replies:
    5
    Views:
    1,737
    Itai Raz
    Feb 17, 2004
  2. greg
    Replies:
    1
    Views:
    278
    Peter Strøiman
    Oct 28, 2003
  3. Tom Hartnett

    how to create stand-alone page in VS

    Tom Hartnett, Nov 7, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    1,075
    Keith
    Nov 7, 2003
  4. GS
    Replies:
    1
    Views:
    720
    Nanda Lella[MSFT]
    Apr 13, 2006
  5. Plotinus
    Replies:
    2
    Views:
    313
    Tad McClellan
    Dec 17, 2004
Loading...

Share This Page