;; once inside a module definition, we don't have cond-expand ;; available anymore. in order to get it, we need to do (import ;; chicken.base) for C5 and (import chicken) for C4. so we need ;; cond-expand to import cond-expand. this little macro helper helps ;; us avoid copy-pasing module definitions. (define-syntax mymodule (syntax-rules () ((_ name exports body ...) (cond-expand (chicken-5 (module name exports (import scheme (chicken base)) body ...)) (else (module name exports (import scheme chicken foreign) body ...)))))) (mymodule nanomsg (;; types nn-endpoint? nn-socket? nn-domain->int int->nn-domain nn-option->int int->nn-option nn-option-level->int int->nn-option-level nn-protocol->int int->nn-protocol nn-statistic->int int->nn-statistic nn-term nn-device nn-recv nn-recv* nn-recv! nn-send nn-send* ;; nn-freemsg! nn-connect nn-bind nn-socket nn-socket* nn-shutdown nn-close nn-unsubscribe nn-subscribe ;; socket options nn-setsockopt nn-setsockopt/int nn-getsockopt/int nn-setsockopt/string nn-getsockopt/string nn-getsockopt/string! ;; socket option wrappers nn-socket-name nn-socket-linger nn-socket-rcvtimeo nn-socket-sndtimeo nn-socket-rcvbuf nn-socket-sndbuf nn-socket-sndfd nn-socket-rcvfd nn-socket-protocol nn-socket-domain nn-socket-maxttl nn-socket-rcvmaxsize nn-socket-rcvprio nn-socket-sndprio nn-socket-reconnect-ivl-max nn-socket-reconnect-ivl nn-socket-ipv4only nn-req-socket-resend-ivl ;; flags nn/ws-msg-type-binary nn/ws-msg-type-text nn/dontwait ;; util nn-get-statistic) ;; macro places use/import here (include "nanomsg.scm") )