Click here to Skip to main content
16,004,836 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dialog Window Pin
David Crow10-Aug-07 4:07
David Crow10-Aug-07 4:07 
QuestionC, C+, C# to C++ Pin
Jay Minor9-Aug-07 18:40
Jay Minor9-Aug-07 18:40 
AnswerRe: C, C+, C# to C++ Pin
_AnsHUMAN_ 9-Aug-07 19:53
_AnsHUMAN_ 9-Aug-07 19:53 
AnswerRe: C, C+, C# to C++ Pin
Hamid_RT10-Aug-07 1:08
Hamid_RT10-Aug-07 1:08 
GeneralRe: C, C+, C# to C++ Pin
Jay Minor11-Aug-07 12:29
Jay Minor11-Aug-07 12:29 
GeneralRe: C, C+, C# to C++ Pin
Hamid_RT11-Aug-07 20:59
Hamid_RT11-Aug-07 20:59 
QuestionMixing C and C++ code Pin
ForNow9-Aug-07 18:36
ForNow9-Aug-07 18:36 
AnswerRe: Mixing C and C++ code Pin
Cedric Moonen9-Aug-07 20:28
Cedric Moonen9-Aug-07 20:28 
ForNow wrote:
From what I understand if you want the C++ compiler to interpet a peice of code as C you preface it with extern "C"


Nope, that's not the purpose of extern "C". The purpose of extern "C" is taht your C++ compiler will create a C linkage of the functions inside the block. The difference between C and C++ linkage is that in C++ there is function overloading, meaning that you can have several functions with the same name but different arguments. The linker, to differentiate those functions uses name mangling (the function is identified by its name and with special characters that 'describe' its parameter list). In C, you don't have function overloading so the linker uses the name of the function only to identify a function.
So, when you specify an extern "C" block, all the functions inside that block will have a C linkage (meaning also that you won't be able to overload them).

So, you cannot simply have C++ code and wrap it with extern "C" so that it can be compiled with a C compiler.


Cédric Moonen
Software developer

Charting control [v1.2]

GeneralRe: Mixing C and C++ code Pin
ForNow9-Aug-07 23:26
ForNow9-Aug-07 23:26 
GeneralRe: Mixing C and C++ code Pin
Cedric Moonen9-Aug-07 23:41
Cedric Moonen9-Aug-07 23:41 
GeneralRe: Mixing C and C++ code Pin
ForNow10-Aug-07 6:25
ForNow10-Aug-07 6:25 
GeneralRe: Mixing C and C++ code Pin
jhwurmbach10-Aug-07 1:58
jhwurmbach10-Aug-07 1:58 
GeneralRe: Mixing C and C++ code Pin
ForNow10-Aug-07 6:29
ForNow10-Aug-07 6:29 
GeneralRe: Mixing C and C++ code Pin
jhwurmbach10-Aug-07 6:36
jhwurmbach10-Aug-07 6:36 
GeneralRe: Mixing C and C++ code Pin
ForNow10-Aug-07 11:52
ForNow10-Aug-07 11:52 
GeneralRe: Mixing C and C++ code Pin
jhwurmbach12-Aug-07 23:12
jhwurmbach12-Aug-07 23:12 
GeneralRe: Mixing C and C++ code Pin
ForNow13-Aug-07 0:51
ForNow13-Aug-07 0:51 
QuestionAddString() function again Pin
tyagineha9-Aug-07 18:11
tyagineha9-Aug-07 18:11 
AnswerRe: AddString() function again Pin
Nelek9-Aug-07 20:31
protectorNelek9-Aug-07 20:31 
AnswerRe: AddString() function again Pin
jhwurmbach9-Aug-07 22:17
jhwurmbach9-Aug-07 22:17 
AnswerRe: AddString() function again Pin
Hamid_RT10-Aug-07 1:11
Hamid_RT10-Aug-07 1:11 
QuestionWriteFile and fwrite Pin
George_George9-Aug-07 17:33
George_George9-Aug-07 17:33 
AnswerRe: WriteFile and fwrite Pin
Paresh Chitte9-Aug-07 18:34
Paresh Chitte9-Aug-07 18:34 
GeneralRe: WriteFile and fwrite Pin
George_George9-Aug-07 20:52
George_George9-Aug-07 20:52 
QuestionAbout active console session id Pin
fd01290029-Aug-07 16:24
fd01290029-Aug-07 16:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.