|
-
August 23rd, 2012, 05:07 AM
#3
Re: How to use custom "C" library with C++ codes
 Originally Posted by zz1234
In my custom library header, I just have this line of code: "double BankAccountBal ( ) ;".
This is where you're wrong. C and C++ are different languages. So, the same line is interpreted different been compiled in C unit compared to C++ one. Compiled in C the line declares _BankAccountBal symbol while in C++ it is ?BankAccountBal@@YANXZ. So you need a special trick to make this be compiled identically:
Code:
#ifdef __cplusplus
extern "C" {
#endif
/* here C stuff goes */
#ifdef __cplusplus
}
#endif
Best regards,
Igor
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|