chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Problem embedding srfi-42


From: Jeronimo Pellegrini
Subject: [Chicken-users] Problem embedding srfi-42
Date: Wed, 28 Oct 2009 17:36:05 -0200
User-agent: Mutt/1.5.20 (2009-06-14)

Hi,

I think I understand how ot embed Scheme in C, and got
some simple examples to work (even passing variable
pointers to Scheme functions and getting Scheme code
to change the values of the variables -- it's easier
than I initially thought!)

But now I'm trying to embed code that uses srfi-42,
and it doesn't work.

See this example:
 
  test.scm:
/--------------------

(require-extension srfi-42)

;; OK, not a good procedure name, but it's just a test
(define n-string
  (lambda (c n)
    (string-ec (: i 0 n) c)))

(define-external (repeat (int n) (char c)) c-string
  (n-string c n))

(return-to-host)
\--------------------

  t.c:
/--------------------
#include <chicken.h>
#include <stdio.h>

char* repeat (int n, char c);

int main() {
    CHICKEN_run(C_toplevel);
    puts(repeat(10,'a'));
}
\--------------------

I compiled with:

$ csc test.scm test-.c -e -R srfi-42

And got an executable (no errors or warnings!)

But when I run it:

/--------------------
$ ./test 

Error: unbound variable: srfi-42#:-dispatch

    Call history:

    test.scm: 12   return-to-host       
    test.scm: 10   n-string            <--
\--------------------

I also tried without the "-R srfi-42" option, and got the same error.

What is the right way to compile code that uses this library (or any
other library)?

Thanks a lot,
J.





reply via email to

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