c++ function can not call c routine or access c global variable. Why?
dave at thesmithfam.org
Thu Mar 23 06:42:22 MST 2006
Laurent R wrote:
> Hi, All:
> There are two parts of codes in my project. One is implemented with
> C++, the other is C. I compiled them repectively and link together.
> But I found the problem. The function in C++ can not call the routine
> coded with c. It will crash the system. And also the function in C++
> can not access the global variable defined in C. It will get the
> un-initialized value from the global variable.
> Have u met this kind of problem? Who can help me to explain this kind
> of problem?
Did you compile both parts of the code with the same C++ compiler? Did
you use extern "C" where necessary?
More information about the PLUG