seattlerb / rubyinline

297 stars 42 forks source link

Pass type def in inline c #10

Closed thiagocifani closed 13 years ago

thiagocifani commented 13 years ago

I've tried to use any builder arguments but I didn't find any argument that works with my typedef. It defines a symbol for true and false in c. it looks like more readable.

typedef int bool;

define TRUE 1

define FALSE 0

do you know if it is possible?

apohllo commented 13 years ago

I guess it would be better to pass Ruby true/false as VALUE and write a C routine that translates these values into your C values. Still, if most of your code is Ruby, such definitions don't seem to be necessary.

zenspider commented 13 years ago

apohilo is right. Pass in a ruby boolean and use RTEST(x).

Close this if it solves your issue.

zenspider commented 13 years ago

I'm guessing your issue is solved.

You might also want to look at #prefix and the type registry... but I still stand behind apohilo's suggestion to use VALUEs from the start.

thiagocifani commented 13 years ago

Yep, I used value in that values! thanks! sorry I am late