chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] checking whether a C macro is defined


From: Antony Lee
Subject: [Chicken-users] checking whether a C macro is defined
Date: Thu, 16 Aug 2012 16:37:08 -0700

Hi all,
I am looking for a way to check if a symbol is #defined as a C macro or not... something like

(declare (foreign-declare "#include <foo.h>"))
(foreign-code #<<EOF
#ifndef FOO
#define FOO -1
#endif
EOF
)
(define-foreign-variable FOO int)

which doesn't work (because I cannot put C macros in foreign-code?).

My second try was to use the bind egg:
(bind* #<<EOF
#ifndef FOO
#define FOO -1
#endif
EOF
)

but now FOO is always redefined (i.e. #ifndef FOO always evaluates to true).

Any suggestions?  (I guess I could always put all that in an actual header file full of #ifndef's and #include *that* one but I am looking for something more... elegant if possible.)
Thanks,
Antony

reply via email to

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