kde-core-devel@kde.org
[Top] [All Lists]

Re: A little review of kdecore & kdeui

Subject: Re: A little review of kdecore & kdeui
From: Thiago Macieira
Date: Sat, 8 Apr 2006 10:25:10 +0200
Simon Hausmann wrote:
>What exactly is the problem with compilling them into a static library?
> What exactly do you think is unportable?

The linking. You can't link a shared library to a static library. The 
linker simply doesn't let you.

[testing]

Interesting. Turns out I was wrong. It is doing the correct thing:
$ cat static1.c
void functionInStatic()
{
}

void anotherFunctionInStatic()
{
}
$ cat static2.c
void thirdFunctionInStatic()
{
}
$ cat shared.c
void functionInShared()
{
  void functionInStatic();
  functionInStatic();
}

$ gcc -c -fPIC static1.c static2.c shared.c
$ ar rc libstatic.a static1.o static2.o
$ ar rc libstatic.a static1.o static2.o
$ gcc -shared -Wl,-soname,libshared.so.0 -o libshared.so.0.0.0 -L. 
shared.o -lstatic
$ nm -D libshared.so.0.0.0
00000531 T anotherFunctionInStatic
000016a0 A __bss_start
         w __cxa_finalize
000016a0 A _edata
000016a4 A _end
00000578 T _fini
0000050c T functionInShared
0000052c T functionInStatic
         w __gmon_start__
000003e4 T _init
         w _Jv_RegisterClasses

Now, I have no idea whether this is portable or not.
-- 
Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
  thiago.macieira (AT) trolltech.com     Trolltech AS
    GPG: 0x6EF45358                   |  Sandakerveien 116,
    E067 918B B660 DBD1 105C          |  NO-0402
    966C 33F5 F005 6EF4 5358          |  Oslo, Norway
<Prev in Thread] Current Thread [Next in Thread>