Re: FFI: how to avoid naming arguments in C functions

2020-03-22 Thread shashlick
https://github.com/nimterop/nimterop/issues/171#issuecomment-602387909

Re: FFI: how to avoid naming arguments in C functions

2020-03-10 Thread mantielero
Thanks for that. I was looking about how that was called (enum offsets).

Re: FFI: how to avoid naming arguments in C functions

2020-03-10 Thread timothee
=> I filed it here: [https://github.com/nimterop/nimterop/issues/171](https://github.com/nimterop/nimterop/issues/171)

Re: FFI: how to avoid naming arguments in C functions

2020-03-10 Thread mantielero
Nimterop has other issues (I should file it). For instance: toast -pnrk VapourSynth.h creates the following enums: pfRGB24* = (cmRGB + 10).VSPresetFormat pfRGB27* = 29.VSPresetFormat pfRGB30* = 30.VSPresetFormat pfRGB48* = 31.VSPresetFormat

Re: FFI: how to avoid naming arguments in C functions

2020-03-10 Thread mantielero
@akavel no problem and I understand (I can imagine). @shashlick thanks for that. Very useful. I have left my spaguetty code [here](https://github.com/mantielero/h2nim.py) (I called it **h2nim.py** ). It uses [pyclibrary](https://pyclibrary.readthedocs.io/en/latest/) under the hood. It is far

Re: FFI: how to avoid naming arguments in C functions

2020-03-10 Thread Araq
Read this section [https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst#def-directive](https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst#def-directive) but the introduction also tries to explain it.

Re: FFI: how to avoid naming arguments in C functions

2020-03-10 Thread shashlick
To get you started, [here's](http://ix.io/2dTc/nim) the wrapper output from: toast -pnrk gr.h Run Toast is the c2nim equivalent from nimterop.

Re: FFI: how to avoid naming arguments in C functions

2020-03-09 Thread akavel
Please try to not take offence with Araq's occasional snappy replies; I can only assume he sometimes gets tired with the maintainer role & responsibilities, which indeed can be exhausting at times; I know I myself am sometimes less polite than I'd like to be when I'm overly tired, even to

Re: FFI: how to avoid naming arguments in C functions

2020-03-08 Thread mantielero
I will take a look to ggplotnim. Looks interesting. I have played with both nimterop and c2nim before. Thanks a lot.

Re: FFI: how to avoid naming arguments in C functions

2020-03-08 Thread kaushalmodi
Also related to your C library wrapping project, have a look at [https://github.com/nimterop/nimterop](https://github.com/nimterop/nimterop). Using that, I have successfully wrapped quite a few C libraries, and this is coming from someone who has never coded in C (of course, some learning curve

Re: FFI: how to avoid naming arguments in C functions

2020-03-08 Thread kaushalmodi
Related to your plotting application, also have a look at ggplotnim: [https://github.com/Vindaar/ggplotnim](https://github.com/Vindaar/ggplotnim) . It helps me make things like:

Re: FFI: how to avoid naming arguments in C functions

2020-03-08 Thread mantielero
Thanks for the clarification.

Re: FFI: how to avoid naming arguments in C functions

2020-03-08 Thread mashingan
$ c2nim --header gr.h gr.h(27, 25) Error: token expected: ; Run AFAIK, c2nim cannot read something with c custom macro. You can edit the header temporarily to remove that custom macro. In this case it's the `DLLEXPORT`.

Re: FFI: how to avoid naming arguments in C functions

2020-03-08 Thread mantielero
Or alternative, you can point me in the right direction if you actually know what is the problem. I read the documentation, despite neither [here](https://github.com/nim-lang/c2nim) nor [here

Re: FFI: how to avoid naming arguments in C functions

2020-03-08 Thread Araq
Well alternatively you can read c2nim's documentation.

Re: FFI: how to avoid naming arguments in C functions

2020-03-08 Thread mantielero
When I try to use c2nim, it tends to fail while parsing stuff (vapoursynth and gr). Por example, with [gr.h](https://github.com/sciapp/gr/blob/master/lib/gr/gr.h): $ c2nim --header gr.h gr.h(27, 25) Error: token expected: ; $ c2nim --dynlib /usr/gr/lib/libGR.so

Re: FFI: how to avoid naming arguments in C functions

2020-03-08 Thread Araq
> where I have to add a, b, c just to make it work. Yeah, well you do have to do that. c2nim automates it for you.

Re: FFI: how to avoid naming arguments in C functions

2020-03-08 Thread mantielero
By the way, I am just playing with [gr framework](https://gr-framework.org/). #import gr_wrapper const libName = "/usr/gr/lib/libGR.so" proc gr_initgr*(){.importc,dynlib: libName.} proc gr_polyline*(a:cint, b:ptr cdouble, c:ptr cdouble)

FFI: how to avoid naming arguments in C functions

2020-03-08 Thread mantielero
Is it possible to avoid giving names to arguments in the functions? I have the following in the C header: DLLEXPORT void gr_polyline(int, double *, double *); Run and in order to make it work, I have to do: proc gr_polyline*(a:cint, b:ptr cdouble, c:ptr