C++ DLL and C main program

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Toondalis

    C++ DLL and C main program

    I am now extending a Program that is written in C thru DLL. The Main
    program will call functions in my DLL . The problem is that i wanted
    to write my extenstion in C++ instead of C , How can it be done?

    thanks

    seewan
  • Ekkehard Morgenstern

    #2
    Re: C++ DLL and C main program

    Hi Seewan,

    "Toondalis" <seewan@surreal .com.sg> schrieb im Newsbeitrag
    news:4977da50.0 311131720.30afe 861@posting.goo gle.com...[color=blue]
    > I am now extending a Program that is written in C thru DLL. The Main
    > program will call functions in my DLL . The problem is that i wanted
    > to write my extenstion in C++ instead of C , How can it be done?[/color]

    That's simple. You just encapsulate the block with API functions in an "
    extern "C" { ... } " block. :-)

    Or declare only the APIs as having C linkage:

    extern "C" void __declspec(dlle xport) MyGreatAPIFunct ion( void*
    argument ) {
    // do C++ stuff
    }

    I hope that helps! :-)

    regards,
    Ekkehard Morgenstern.


    Comment

    Working...