Rojj Rojj - 7 months ago 25
Ruby Question

Ruby C Extensions - Add System Frameworks

I am building a C extension that uses the Mac OSX Accelerate Framework.
When I compile normal C code I include the header

#include <Accelerate/Accelerate.h>


and compile with

llvm-gcc -framework Accelerate code.c -o code


The flag takes care of finding the right libraries.
Can I do something similar for a ruby C extension? I assume I need to include the framework in
extconf.rb
but I don't know how.

Answer

To use a framework in a Ruby extension, you need to use the have_framework method in your extconf.rb. This will add the appropriate command line options in the Makefile.

In your case you want:

have_framework('Accelerate')