C++ DLL and C main program

T

Toondalis

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
 
E

Ekkehard Morgenstern

Hi Seewan,

Toondalis said:
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.
 

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,776
Messages
2,569,603
Members
45,191
Latest member
BuyKetoBeez

Latest Threads

Top