chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Accessing C macro definitions from scheme?


From: Burton Samograd
Subject: [Chicken-users] Accessing C macro definitions from scheme?
Date: Sat, 16 Aug 2003 10:08:03 -0700
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Hi,

I'm trying to write a simple interface wrapper for a small library I
would like to use and I can seem to be able to acess constant #define's
in a way that seems reasonable.  What I'm looking for is something
like this:

-----------------------------------------------------------------------

/* header.h */
#define MY_DEFINED_VALUE (0L)

-----------------------------------------------------------------------

;;; wrapper.scm
(declare
        (export
                my-defined-value))

; include the header so we can get at MY_DEFINED_VALUE
(declare (foreign-declare "#include \"header.h\""))

(define my-defined-value
        ( +++ WHAT GOES HERE TO GET THE VALUE OF MY_DEFINED_VALUE? ***))

-----------------------------------------------------------------------

I would like to be able to compile the wrapper.scm using 'csc -s
wrapper.scm' to produce wrapper.so, be able to load it into csi with a
(require 'wrapper) and then be able to access my-defined-value, but so
far I haven't be able to get it to work.

##core#inline looked promising, but also didn't seem to do what I
  wanted unless I defined a macro that took a parameter which returned
  the define, such as this:

(declare (foreign-declare "#define CONST(arg) arg"))
(define my-defined-value (##core#inline CONST MY_DEFINED_VALUE))

Unfortunately since chicken lowercases the MY_DEFINED_VALUE this
doesn't work.

Is there any simple way to get access to these defines through the C
programming interface?

-- 
burton samograd
address@hidden
http://kruhftwerk.dyndns.org





reply via email to

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