473,503 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jul 19 '05 #1
1 2123
Hi Seewan,

"Toondalis" <se****@surreal.com.sg> schrieb im Newsbeitrag
news:49**************************@posting.google.c om...
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.
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

45
3556
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes...
15
2863
by: Fred Zwarts | last post by:
In C++ execution of a program starts already before execution of main(). The initialization of static variables defined outside the scope of main is performed first. I could imagine a program where...
9
2172
by: Neelesh | last post by:
Hi all, it is strange that the following code compiles and runs (tested with g++ 3.4.2) #include <iostream> using namespace std; int main(int a, int b, int c, int d, int e) { cout <<...
12
1728
by: Bill Cunningham | last post by:
> #include <stdlib.h> > #include <stdio.h> > > int main(int argc, char *argv) { > FILE *in, *out; > > if(argc==1) > { > in = stdin; > out = stdout;
75
9807
by: Beni | last post by:
I have been programming in C for about a year now. It sounds silly, but I never took the time to question why a C(or C++ or Java) program execution begins only at the main(). Is it a convention or...
16
398
by: junky_fellow | last post by:
I was reading the various posts in this newsgroup, and found that main function should be declared as int main(void) // if no arguments are passed to main i wanted to know whats the purpose of...
17
1632
by: Fred Nelson | last post by:
Hi: I'm trying to implement an overall error handler in my VB.NET windows application. I need to place an "On Error Goto" in "Sub Main". I have tried to create a Sub Main and have had no...
2
1965
by: =?ISO-8859-15?Q?Luigi_Malag=F2?= | last post by:
Hello, i'm having a problem with "multiple definition error" linking a library. I have a program with a main. I have another program with classes and a main too. I created a library of the second...
6
3798
by: fatwallet961 | last post by:
is the main function in python is exact compare to Java main method? all execution start in main which may takes arguments? like the follow example script - def main(argv): ...
6
2552
by: chang | last post by:
Hi ALL, I am working in C from past few months. Still now i can't figure out who is called main() in 'C' programme? Main() is a function from that we can call our sunroutines but someone has to...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7086
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.