chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] re: Compiling a Shared Library from a SWIG interface


From: felix winkelmann
Subject: Re: [Chicken-users] re: Compiling a Shared Library from a SWIG interface
Date: Sun, 5 Nov 2006 10:21:38 +0100

On 11/5/06, Michael McDermott <address@hidden> wrote:

Hi, Michael!

I wrote a SWIG interface for OGLFT (a C++ library to handle FreeType fonts
in OpenGL) and generated the source files with the command

swig -chicken -c++ interface.i

The files were generated correctly, so I ran (I also tried skipping this
step):

chicken *.scm -output-file oglft.c

and then:

csc -I[include dirs for C++ headers...] -sv *.cxx *.c -o interface.so

The shared library was generated without errors. I then ran the chicken
interpreter and ran

#;1> (require 'oglft)
; loading ./oglft.so ...
Error: (load) unable to load compiled module
"./oglft.so"
#f

        Call history:

        <eval>          (require (quote oglft)) <--
#;1>

So what I am trying to figure out is which step, if any, in the creation of
the library was incorrect?

If you use "chicken", you should pass "-shared" (or "-dynamic") as
it does a few things that are needed to generate a dynamically
loadable module. But actually you should probably avoid using "chicken"
and try "csc" instead, as it invokes all the necessary steps with
the proper options. It is also important to pass "-nounit" to swig,
otherwise you will have not default entry-point in the compiled
module.

This should work:

swig -chicken -c++ -no-unit interface.i
csc -I... -sv -c++ interface.scm interface_wrap.cxx -o interface.so


cheers,
felix

--
http://galinha.ucpel.tche.br:8081/blog/blog.ssp




reply via email to

[Prev in Thread] Current Thread [Next in Thread]