[nim-dev] Re: pragma emit question

  • From: Clay Sweetser <clay.sweetser@xxxxxxxxx>
  • To: nim-dev@xxxxxxxxxxxxx
  • Date: Tue, 17 Nov 2015 02:48:57 -0500

Ouch. It would probably be better to look at the underlying functions those
macros use, and try recreating the macros by hand, if they're that complex.
Though, I'm not sure how well libmill will work with Nim's GC, have your
worked that out?
(Also, if I recall correctly, there is some experimental coroutine support
in Nim already, though it might be stuck in a PR)
On Nov 17, 2015 2:33 AM, "terry" <terry.chen@xxxxxxxxxx> wrote:

Hi, sorry. Indeed, I wasn't being clear.

I would like to call the libmill C library from Nim. The goal is to add a
simple lightweight go-like CSP library to the Nim language. The problem is
that the libmill C library's API are all based on C MACROs (see `here <
https://github.com/sustrik/libmill/blob/master/libmill.h>`_) which I can
not figure out how to invoke directly from Nim (importc didn't work for me
on a macro).

I tried c2nim, but it choked on the complex defines in libmill.h.

Unfortunately, the macros are key to libmill's capability as it relies on
C's __FILE__ and __LINE__ plus setjmp / longjmp to achieve the coroutine
like effects.

Thanks for your help!



Other related posts: