C++ DLL and C main program

Discussion in 'C++' started by Toondalis, Nov 14, 2003.

  1. Toondalis

    Toondalis Guest

    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
    Toondalis, Nov 14, 2003
    #1
    1. Advertising

  2. Hi Seewan,

    "Toondalis" <> schrieb im Newsbeitrag
    news:...
    > 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?


    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(dllexport) MyGreatAPIFunction( void*
    argument ) {
    // do C++ stuff
    }

    I hope that helps! :)

    regards,
    Ekkehard Morgenstern.
    Ekkehard Morgenstern, Nov 14, 2003
    #2
    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. Toondalis

    Mix C++ DLL with C main program

    Toondalis, Nov 14, 2003, in forum: C Programming
    Replies:
    1
    Views:
    311
    Mark A. Odell
    Nov 14, 2003
  2. ravi
    Replies:
    28
    Views:
    954
    Richard Heathfield
    Sep 26, 2007
  3. blackbiscuit
    Replies:
    4
    Views:
    336
    James Kanze
    Nov 12, 2008
  4. H. Simpson
    Replies:
    4
    Views:
    247
    H. Simpson
    Aug 3, 2004
  5. Jens Peter Hansen
    Replies:
    7
    Views:
    500
    Randy Webb
    Jun 19, 2004
Loading...

Share This Page