[Bug c++/45880] Template-Methode in Shared Object not resolved when compiled with -O2

r.menges at nice2cu dot de gcc-bugzilla@gcc.gnu.org
Mon Oct 4 16:14:00 GMT 2010


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45880

--- Comment #4 from r.menges at nice2cu dot de 2010-10-04 16:14:34 UTC ---
(In reply to comment #3)
> Please also show the error you're getting, as "crashes the application because
> of a symbol-not-defined-error" is not very helpful
> 
> I don't think this has anything to do with using a template function, I think
> you've just built it wrong

Actually i didn't write the makefile myself, it was generated by netbeans
(6.7.).
I am sorry, i was inexact about the error message: The symbol-not-defined
is the error i see when using the original-code, which is executed in an apache
context. The example simply crashes with an segfault.

But you are right, the option -share is what caused the segfault in this
example.
After i removed the -shared option manually from the generated makefile, the
example crashes no more.

The "real" applications runs as an extension to php5 in the context of apache,
it's an libary for c++-php-bridge we builded (so that c++-objects can be mapped
into the space of php). This is where undefined symbol errors crashes the
httpd-process with an error of undefined symbol, when using 

template<typename MsgType> void printMessage(MsgType msg);
void printMessage(const char *);

it misses the implemetation for std::string.



More information about the Gcc-bugs mailing list