This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: C++ program with C shared object?
Thank you,
I finally got the program to compile by using gcc to call the linker, and
specifying -lstdc++ as well. Now I have one more problem. My goal is to
have the library call a callback function from the executable. This
callback function will throw an exception, which will be caught by the
function in the application that initially called the shared library. The
goal is to create an Exception based error handling system, even though the
shared object is written in C, not C++.
The same code base works as a Windows C DLL and C++ Program, so I'm sure
I'm just missing a compiler flag or something.
Both the library and program are compiled with the command line options
-fexceptions -frtti
But at the point where the exception should have been thrown, I only see
the text, 'Aborted' on stdout, although that phrase is not in my source
code at all.
Is the library having trouble calling the callback function, or is
the exception having trouble making its way through the C library back to
the application?
Again, thanks to the response to the initial question, and thank you for
any help you can lend me.
-Josh
At 09:10 PM 12/28/2001 +0100, bjorn rohde jensen wrote:
>Hi,
>
> If you want to use the linker directly to link object files, you do
>have
>to tell it, where to find quite a few libraries, including the standard
>libraries provided by a C++ compiler. I would suggest using the compiler
>to drive the linker, that way it will handle this sort of thing for you,
>and have it pass your special linker options to the linker.
>
>
>Yours sincerely,
>
>Bjorn
--
Joshua Pollak (617) 491-3474 x586
Software Engineer joshp@cra.com
Charles River Analytics www.cra.com
---------------------------------------