Boost logo

Boost Users :

From: Hughes, James (jhughes_at_[hidden])
Date: 2006-06-21 04:33:02


Hello all,

I didn't get an answer to my question about a good C++/Templates mailing
list (I am sure there is one, or maybe our c**p email system has culled
any replies), so, since I am sure that the problem I am encountering
must have been solved/avoided in the Boost libs I will ask here.

I have a template, solely defined in a header file header.h. This
template has a static factory function in case that's important.

This is used by code in a shared library, shared.cpp->shared.so

The main application (app) also uses the template.

When I link my app without including the shared library, all is fine.
When I start to use the shared library, I get a seg fault on app startup
(doesn't even get to main()).

I think this is a translation unit problem (Hope term is correct). When
the shared.so is compiled, it must create instances/functions based on
the template. When app is compiled, it also must be instantiating the
same functions, since I don't think it can know about the ones in
shared.so.

So, when system attempts to start up there is some sort of conflict
between the template instances in the shared lib and the ones in the app
itself - there are effectively two sets of template code do the same
thing with the same name.

I have done some checking on the net, and have not yet seen how to avoid
this problem, but of course it's quite possible I have got hold of
completely the wrong end of the stick! I think I may be in the right
track with -frepo and -fno-implicit-templates compiler flags, but I am
not sure.

Any help gratefully received.

James

This message (including any attachments) contains confidential
and/or proprietary information intended only for the addressee.
Any unauthorized disclosure, copying, distribution or reliance on
the contents of this information is strictly prohibited and may
constitute a violation of law. If you are not the intended
recipient, please notify the sender immediately by responding to
this e-mail, and delete the message from your system. If you
have any questions about this e-mail please notify the sender
immediately.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net