Click to See Complete Forum and Search --> : MSVC 1.52 C++


rereid
December 20th, 1999, 10:27 AM
I want to create a library of C++ routines and call them from C (not ++). I declared the routines as __cdecl and can not get past unresolved external reference. In other words the symbols are decorated for C++ and the C program cant resolve them. Of course I have no problem linking C to C or C++ to C++.

Any ideas??

Bob Reid

Eddie Velasquez
December 20th, 1999, 02:33 PM
Declare them as extern "C".

#if defined(__cplusplus)
extern "C" {
#endif

int __cdecl MyFunc(int x);

#if defined(__cplusplus)
};
#endif



BTW, this post is off-topic.


-------------------------------------------
I don't do it for the ratings, but a useful
reply deserves a positive rating ;-)
-------------------------------------------