What is the deal with undefined symbols in a shared library or dylib?

后端 未结 2 559
故里飘歌
故里飘歌 2021-01-17 08:47

I have a Makefile for linux that I am porting over to Darwin. The makefile takes a bunch of .o files and links them together into a .so shared object. Okay, so I figured (

2条回答
  •  情书的邮戳
    2021-01-17 09:17

    This thread also discusses this issue. I think the key point is that in order to get the Linux-like linking behavior, you need to specify the "-undefined dynamic_lookup" flag. By default, the Darwin linker throws an error if there are any undefined references in a dynamic library. You can also use -U to set this behavior on a per-symbol basis. See 'man ld' for reference.

提交回复
热议问题