How do I create a dynamically loadable version of RtAudio in OSX
I need to create librtaudio.dylib, a dynamically loadable RtAudio library (http://www.music.mcgill.ca/~gary/rtaudio/). I'd like to write CFFI bindings (in SBCL) but I can't seem to compile a dylib that is loadable using CFFI. Here are the compiler and linker commands I'm using to create the dylib:
g++ -O2 -Wall -Iinclude -fPIC -DHAVE_GETTIMEOFDAY -D__MACOSX_CORE__ -c RtAudio.cpp -o RtAudio.o
g++ -dynamiclib -install_name /usr/local/lib/librtaudio.dyli开发者_开发百科b -lSystem -compatibility_version 1.0 -current_version 1.0 RtAudio.o -o librtaudio.dylib -lpthread -framework CoreAudio -framework CoreFoundation
It seems that CFFI's C++ support is not adequate to load RtAudio, as it is a C++ lib. A workaround is to write a C wrapper around RtAudio and then write bindings to the wrapper.
精彩评论