This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Creating C library implemented in C++


Stuart, 

If you declare your functions in an 'extern "C"' block and then compile
and link them with g++, I think you'd have the effect you are looking
for, and your exception handling problem should also be taken care of.
The 'extern "C"' block should disable the name mangling, allowing the
functions to be used from a C program and using their own C compiler.
Linking it with g++ will add all extra command line arguments needed to
enable support for stack unwinding, etc., necessary for exception
handling.

Cheers,
Lyle

-----Original Message-----
From: Stuart F. Downing [mailto:sdowning@fame.com] 
Sent: Tuesday, October 21, 2003 9:48 AM
To: gcc-help@gcc.gnu.org
Subject: Creating C library implemented in C++

I am porting a C library to C++.  The library is distributed in both
shared and static verstions.  The resultant library must still be
callable from C clients.

PROBLEM: Any exceptions thrown result in program termination, not
tranfer of control to the enclosing try/catch.  



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]