g-wrap-dev
[Top][All Lists]
Advanced

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

Re: G-Wrap 1.9.3 testing tarball available


From: Greg Troxel
Subject: Re: G-Wrap 1.9.3 testing tarball available
Date: 05 Nov 2004 17:28:54 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

I'm running 1.9.3 (from http://savannah.nongnu.org/download/g-wrap/)
with guile 1.6.4 on NetBSD/i386 2.0ish.  guile and g-wrap are built
with pkgsrc, so both --prefix=/usr/pkg

I'm trying to replicate the example in the info file, and losing.

First, after running my code in guile, I have a new class but nothing
else happens.  It seems to me I have to make an object of the new
wrapset type so the init methods run, and it's not clear how that
happens, or how I should compile/link any resulting .c files that get
generated.

I assume the point is to generate a scheme module that can be used,
which dynamic-links both the new glue and the library.

My very simple C code that I'm trying to wrap:
----------------------------------------
#include "foo.h"  # has just a declaration for foo
#include <stdlib.h>

char *
foo(int bar)
{
  char *s = malloc(8);

  sprintf(s, "%4d", bar);

  return s;
}
----------------------------------------
My scheme code:

----------------------------------------
(use-modules (oop goops) (g-wrap) (g-wrap guile) (g-wrap gw-standard-spec))

(define-class <foo-wrapset> (<gw-guile-wrapset>)
  #:id 'foo
  #:dependencies '(standard))

(define-method (initialize (ws <foo-wrapset>) initargs)
  (next-method ws (append '(#:module (foo)) initargs))

  (wrap-function!
   ws
   #:name 'foo
   #:returns '(mchars caller-owned)
   #:c-name "foo"
   #:arguments '((<gw-int> bar))
   #:description "Given an integer, return a string representation."))
----------------------------------------

I added the gw-standard-spec module after reading g-wrap code - it is
NOT in the info file.
This all runs without problems.  I have a new class:

(apropos "foo") ==> (guile-user): <foo-wrapset>

Then, I see nothing in the example telling me how to actually make a
wrapset.  I tried:

(make <foo-wrapset>)

and got errors about standard not being defined.

So, if the docs are just hold, fixing up the example to work, and
filling in how to generate the code and build it would be really nice.

I'm going to look through the g-wrap source and guile-gnome source,
although I expect the latter to be a wee bit too complex to serve as a
newbie example.

    Thanks,
    Greg


-- 
        Greg Troxel <address@hidden>





reply via email to

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