|
-
Sep 19th, 2000, 02:21 PM
#1
Hey whats up all..
I have VC++ COMPILER on my puter and i grabbed a bunch of C source codes from a site...so what i am asking is..what huge drastic change of life will i have to go through to use these C codes on my VC++ compiler? ..i have been told there wasnt a huge difference between C and C++ but then again we are dealing with Microsoft Compiler here..so anything is possible.
Any help will be appreciated.
-
Sep 19th, 2000, 04:00 PM
#2
Monday Morning Lunatic
Any C++ compiler will compile C. Just chuck your C source through. Although, if you want to use C functions from C++, you have to use the extern "C" trickery, which is a bit complex and documented on MSDN.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 19th, 2000, 05:48 PM
#3
Kool thanks but...
When you say
"Although, if you want to use C functions from C++, you have to use the extern "C" trickery, which is a bit complex and documented on MSDN."
You are saying..if i want to use C functions in a C++ program i would have to do that "C" Trick? or if i wanted to use a C++ function in a C program i would have to do the "C" trick?
Thanks Parksie.
"I know am an *******..it says so on mah birth certificate!"
-
Sep 20th, 2000, 12:25 PM
#4
Monday Morning Lunatic
Okay. Here's a scenario:
You are given a .obj file, compiled on a C compiler by someone. You also have the header file. However, if you just include it, the linker will complain about not finding names. This is because, to support inheritance and overloading, C++ compilers "mangle" function/variable names. Therefore, you would do this:
Code:
extern "C" {
#include "c_include.h"
}
which tells the C++ compiler to use the C naming rules when compiling.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
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
|