[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
success! Re: g-wrap? libffi?
From: |
Steve Tell |
Subject: |
success! Re: g-wrap? libffi? |
Date: |
Wed, 4 Aug 2004 01:53:36 -0400 (EDT) |
It took some doing, but I got g-wrap installed and successfully wrapped
the trivial example in the "2.1 Overview" section of the g-wrap.texi
manual.
G-wrap was easy to build, but its dependencies proved um, interesting.
So I hope the travellogue below might save someone some trouble.
While getting the example running, I think I learned enough to fix
the example in section 2 of g-wrap.texi to work with g-wrap 1.9.1.
My working example is below; is there interest in a patch to the .texi?
Steve
tonight's adventure: trying out g-wrap in N steps:
download g-wrap-1.9.1.tar.gz from
http://savannah.nongnu.org/download/g-wrap/
g-wrap requires libffi.
download libffi-src-20030921.tar.gz from
http://sourceforge.net/project/showfiles.php?group_id=14534
(this is from the PyObjC project)
Inspired by the notes in http://sablevm.org/wiki/LibFFI on how to build
libffi apart from the gcc source, we
hack libffi just slightly
*** libffi-src/configure Sun Sep 21 10:12:09 2003
--- libffi-src-sgt/configure Tue Aug 3 21:46:18 2004
***************
*** 640,645 ****
--- 640,646 ----
else
libffi_basedir=
fi
+ libffi_basedir=.
ac_aux_dir=
for ac_dir in ${libffi_basedir} $srcdir/${libffi_basedir}; do
then "configure;make;make install" as usual to install libffi.
We can now configure and build g-wrap itself.
I recall it being relatively uneventful.
In order to run, g-wrap requires srfi-34, and possibly other stuff
from guile-lib.
download guile-lib from
http://download.gna.org/guile-lib/guile-lib-0.1.1.tar.gz
This doesn't contain srfi-34, which was added after that release.
download the guile-lib snapshot from
http://download.gna.org/guile-lib/daily/guile-lib-20040625.tar.gz
The build process looks like it should be:
$ tar xzf ../download/guile/guile-lib-20040625.tar.gz
$ cd guile-lib-20040625/
$ mkdir build
$ cd build
$ srcdir=../src/guile-lib ../src/configure
But it doesn't work because a file called '=RELEASE-ID' is missing
from the top directory of the 20040625 snapshot. So copy it from the
guile-lib-0.1.1 release.
$ tar xzf ../download/guile/guile-lib-guile-lib-0.1.1.tar.gz
$ tar xzf ../download/guile/guile-lib-20040625.tar.gz
$ cp 'guile-lib-0.1.1/=RELEASE-ID' guile-lib-20040625
$ cd guile-lib-20040625/
$ mkdir build
$ cd build
$ srcdir=../src/guile-lib ../src/configure
$ make
$ make install
G-wrap has a test suite of some kind, part of which is built during
its build process. But I couldn't figure out how to run it.
But we can forge ahead and to wrap a little testcase with g-wrap.
Aside from some typos, the simple example in section 2 of the
documentation isn't too far from working.
But the example gets simpler if the wrapset classes aren't put into
seperate modules. Here's what I wound up with:
; begin my-frob-spec.scm
(use-modules
(oop goops)
(g-wrap)
(g-wrap guile)
(g-wrap guile ws standard))
(define-class <my-wrapset> (<gw-wrapset>)
#:id 'my-wrapset
#:dependencies '(standard))
(define-method (initialize (ws <my-wrapset>) initargs)
(next-method)
(wrap-function! ws
#:name 'frob
#:returns 'int
#:arguments '((int x) (double y))
#:c-name "frob"
#:description "Return the result of frobbing x and y."))
(define-class <my-guile-wrapset> (<my-wrapset> <gw-guile-wrapset>)
#:id 'my-guile-wrapset)
(define-method (global-declarations-cg (ws <my-guile-wrapset>))
(list
(next-method)
"#include \"myfrob.h\"\n"))
(define-method (initialize (ws <my-guile-wrapset>) initargs)
(next-method ws (append '(#:module (my-module)) initargs)))
(generate-wrapset 'guile 'my-guile-wrapset "my-module")
; end my-frob-spec.scm
running
guile -s my-frob-spec.scm
produces
my-module.c and my-module.scm
compile my-module.c and frob.c into a shared object
libgw-guile-my-guile-wrapset.so
and then (use-modules (my-module)) in test.scm - and it works!
- g-wrap? libffi?, Steve Tell, 2004/08/03
- Re: g-wrap? libffi?, Andreas Rottmann, 2004/08/03
- Re: g-wrap? libffi?, Steve Tell, 2004/08/03
- Re: g-wrap? libffi?, Andreas Rottmann, 2004/08/04
- g-wrap <gw-guile-wct> questions, Steve Tell, 2004/08/12
- Re: g-wrap <gw-guile-wct> questions, Andy Wingo, 2004/08/15
- Re: g-wrap <gw-guile-wct> questions, Steve Tell, 2004/08/16
- Re: g-wrap <gw-guile-wct> questions, Andy Wingo, 2004/08/17
- Re: g-wrap <gw-guile-wct> questions, Steve Tell, 2004/08/27
- Re: g-wrap <gw-guile-wct> questions, Andreas Rottmann, 2004/08/18