chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] foreign functions, swig


From: Dan
Subject: [Chicken-users] foreign functions, swig
Date: Fri, 19 May 2006 23:36:34 -0700 (PDT)

Hi all,

I'm trying to create bindings for a large library
(GSL, which is not so popular these days for some
reason) as painlessly as possible. Ideally, I would
write no declarations by hand, just some #include's.

I have tried two approaches:

1) Using SWIG:
%module gsl
%{
#include <gsl/gsl_rng.h>
}
%include <gsl/gsl_rng.h>

This works, but swig has some smart type-checking that
prevents me from passing srfi-4 f64vector's instead of
(double *). I don't know how to convert between the
two in Scheme either.

2) Using Chicken

#>!
extern void gsl_sort (double *v, size_t s, size_t N);
<#

This works with f64vector's, but will be verbose. If I
just place the #include between #>! and <#, it doesn't
get parsed. So I'd have to write lots of extern's.

A further problems is that if I pass plain vector's
instead of f64vector's, csi crashes, but I guess I can
live with that.

Is there an optimal solution?

-- Dan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




reply via email to

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