MAC OSX dylib and how to use them

I downloaded and installed (I think) gtk on Mac OSX (Lion). The compilation of the test program went fine after everything was right. Now the link is broken. Grep for missing entry points

_gtk_init _gtk_window_new ... 11 more 

found them in / Users / ccpalmer / gtk / inst / lib / libgtk -quartz-2.0.0.dylib / Users / ccpalmer / gtk / inst / lib / libgtk -quartz-2.0.dylib

Less familiar with the OSX underlying Unix, I'm not sure how to get through the link step. I have to admit, I've never met dylib before.

Are there any smart OSX developers out there who can shed light on my secret?

Charles

+4
source share
1 answer

As noted above, moshbear, dylib files are how shared libraries are packaged in Mac OS X. To use such a shared library, you need to pass two switches to your compiler -L and -L . The first one adds the directory containing your dylib to the linker library search path, and the second indicates the library for which it is linked. Something like this, for the fictional libfoo.dylib that lives in /usr/mylibs :

 clang code.c -L/usr/mylibs -lfoo 
+5
source

Source: https://habr.com/ru/post/1382111/


All Articles