Linking problem

P

Peetah_junkmail

Hi,

I'm not sure this is completely a C related question since it's more about
linking problems, so don't hesitate to redirect me to a more appropriate
NG.

I have a set of useful functions (let's call this SUF) that facilitates my
life when coding, such as memory allocation wrappers or generic string
functions. I have a project composed of a shared library (SL) and a main
program (MP) using SL. For some reasons, I don't want to make a shared
library from SUF. The problem is that both MP and SL are using functions
from SUF. Hence, there are some conflicts, since MP and SL include each
the same symbols linked from SUF.
To summarize:
code for SUF is build as a convenience static library
code for SL is linked to the SUF convenience static library, linked as a
shared library and installed on the target system
code for MP is linked to the SUF convenience static library, linked to SL
and installed on the target system
Therefore, the SUF code is defined twice, once by SL and once by MP.

Would you have a solution for this ?

thanks
 
J

Jack Klein

Hi,

I'm not sure this is completely a C related question since it's more about
linking problems, so don't hesitate to redirect me to a more appropriate
NG.

I'd like to direct you to a more appropriate newsgroup, but you did
not supply enough information to do so.
I have a set of useful functions (let's call this SUF) that facilitates my
life when coding, such as memory allocation wrappers or generic string
functions. I have a project composed of a shared library (SL) and a main
program (MP) using SL. For some reasons, I don't want to make a shared
library from SUF. The problem is that both MP and SL are using functions
from SUF. Hence, there are some conflicts, since MP and SL include each
the same symbols linked from SUF.
To summarize:
code for SUF is build as a convenience static library
code for SL is linked to the SUF convenience static library, linked as a
shared library and installed on the target system
code for MP is linked to the SUF convenience static library, linked to SL
and installed on the target system
Therefore, the SUF code is defined twice, once by SL and once by MP.

Would you have a solution for this ?

Standard C, which is the topic here, does not have a solution for
this, mainly because it does not even recognize the problem. The
language definition is completely platform neutral. All it requires
is that an implementation allow for separate compilation of individual
translation units, and some method of putting together the results of
those separate compilations into a single executable.

The mechanics of linking are completely outside the scope of the
language, since they vary greatly from one platform to another. Not
all platforms even have "shared" and "static" libraries.

So the best I can do is redirect you in general, to a group that
supports your particular compiler/OS platform. Possibilities include:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top