Here's my artificial example. The Makefile generates an executable
called 'm'.
While it's true that you can build the libraries such that any given
object file appears once, that's not really practical here. The idea is
to have a number of independent libraries that can be mixed and matched
for a particular application. In fact, in my real application the
libraries are dynamically loaded using dlopen().
Thanks for taking a look at this.
Clive
------------------------ f.cpp -----------------------
#include <cstdio>
int *f;
class Fm {
public:
Fm() {
f = new int;
*f = 42;
printf("Created f at %p\n",(char *)f);
}
~Fm() {
printf("Destroying f at %p\n",(char *)f);
delete f;
}
};
static Fm fm;
--------------------- a.cpp -------------------
#include <cstdio>
extern int *f;
void a() {
printf("a: %d\n",*f);
}
-------------------- b.cpp ---------------------
#include <cstdio>
extern int *f;
void b() {
printf("b: %d\n",*f);
}
------------------- m.cpp ------------------------
extern void a();
extern void b();
int main(int argc,char *argv[]) {
a();
b();
}
-------------------- Makefile --------------------
all:
c++ -g -fpic -c m.cpp a.cpp b.cpp f.cpp
c++ -g -fpic -shared -o liba.so a.o f.o
c++ -g -fpic -shared -o libb.so b.o f.o
c++ -g -o m m.cpp -Wl,-rpath,. -L. -la -lb
Karel Gardas wrote:
Hello Clive,
could you be so kind and post as short as possible example here? If I
understand you well, there is no need to link object file with one
concrete marshaler type to two libraries, or is it? IMHO if you link
it only to one library your problem should disappear or am I wrong?
Cheers,
Karel
--
_______________________________________________
Mico-devel mailing list
[email protected]
http://www.mico.org/mailman/listinfo/mico-devel