Interfacing with a C static library?

Hi,

just curious what is the simplest way to use C functions compiled into a
static library (libc.a) from Ruby ?

I have no acces to shared version of that C-lib so I cann’t use standard
DL::dlopen . Only static library and C-header file available.

Do I have to manually write wrapper C shared lib, use SWIG or is there
other more straightforward way ?

Take care.

David

On 1/21/2012 12:16 PM, David U. wrote:

Hi,

just curious what is a simplest way to use C functions compiled into
a
static library (libc.a) from Ruby ?

Without touching Ruby’s runtime library, I don’t think there is any easy
way to use it other than wrapping the static library with a dynamic
library. If the static library can somehow be used in Ruby at runtime,
the static library will need to be called a dynamic library…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs