digitalmars.D.learn - Linking order on Linux matters?
- Jeremy DeHaan (10/10) Nov 25 2013 Hey all,
- Dmitry Olshansky (5/15) Nov 25 2013 AFAIK it's was a somewhat (a couple of years?) recent change but yes,
- Antoche (3/13) Nov 25 2013 Order matters, no matter the language. See
- Jeremy DeHaan (3/19) Nov 25 2013 Thanks!
- Mike Parker (4/9) Nov 25 2013 Note that this also applies to Windows with MinGW (and, I assume,
Hey all, New to Linux, so I wanted to double check something. I have a C shared library and a D static library. The D static library uses functions from the C library. On Windows, it didn't matter what order I linked the .libs in and it always compiled fine. On Linux, however, I have to link the static library first and then the shared library or else I get undefined symbols for each extern(C) function I declare in my D code. Is this normal for Linux or is it a compiler bug? Thanks!
Nov 25 2013
25-Nov-2013 22:19, Jeremy DeHaan пишет:Hey all, New to Linux, so I wanted to double check something. I have a C shared library and a D static library. The D static library uses functions from the C library. On Windows, it didn't matter what order I linked the .libs in and it always compiled fine. On Linux, however, I have to link the static library first and then the shared library or else I get undefined symbols for each extern(C) function I declare in my D code. Is this normal for Linux or is it a compiler bug?AFAIK it's was a somewhat (a couple of years?) recent change but yes, it's the norm on Linux now.Thanks!-- Dmitry Olshansky
Nov 25 2013
On Monday, 25 November 2013 at 18:19:57 UTC, Jeremy DeHaan wrote:Hey all, New to Linux, so I wanted to double check something. I have a C shared library and a D static library. The D static library uses functions from the C library. On Windows, it didn't matter what order I linked the .libs in and it always compiled fine. On Linux, however, I have to link the static library first and then the shared library or else I get undefined symbols for each extern(C) function I declare in my D code. Is this normal for Linux or is it a compiler bug? Thanks!Order matters, no matter the language. See http://stackoverflow.com/a/409470/1924406
Nov 25 2013
On Monday, 25 November 2013 at 20:29:19 UTC, Antoche wrote:On Monday, 25 November 2013 at 18:19:57 UTC, Jeremy DeHaan wrote:Thanks! That's a great link. It cleared up quite a lot.Hey all, New to Linux, so I wanted to double check something. I have a C shared library and a D static library. The D static library uses functions from the C library. On Windows, it didn't matter what order I linked the .libs in and it always compiled fine. On Linux, however, I have to link the static library first and then the shared library or else I get undefined symbols for each extern(C) function I declare in my D code. Is this normal for Linux or is it a compiler bug? Thanks!Order matters, no matter the language. See http://stackoverflow.com/a/409470/1924406
Nov 25 2013
On Monday, 25 November 2013 at 23:25:05 UTC, Jeremy DeHaan wrote:Note that this also applies to Windows with MinGW (and, I assume, Cygwin). It's a GCC thing, not a Linux thing. So I would assume it would arise when using LDC and GDC.Order matters, no matter the language. See http://stackoverflow.com/a/409470/1924406Thanks! That's a great link. It cleared up quite a lot.
Nov 25 2013