Re: re or nre. What should i use? What will be supported in future?
For performance, last I checked, re is faster than nre by a lot.
Re: FOSDEM 2020 - Brussels February 1st & 2nd
Possibly they are waiting for you to review and ok it before putting it on the lecture webpage? It's still not on the website.
Re: Code review request
Oh I completely forgot to make the IDs static with {.global.} pragma. I see I do have other issues. I'll debug them when I get home.
Re: FFI: how to avoid naming arguments in C functions
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
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 is involved, but the community and the nimterop developer shashlick/genotrance was very helpful as I was learning to use nimterop).
Re: FFI: how to avoid naming arguments in C functions
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: Nested list comprehension
As I said, you must use the devel version. You can install it with a tool called choosenim.
Re: FFI: how to avoid naming arguments in C functions
Thanks for the clarification.
Re: FFI: how to avoid naming arguments in C functions
$ 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`.
Times in the VM?
I encountered this problem a while ago and it's not really important to me right now, but I just want to make sure of some things before I forget about it. The `times` module uses FFI for its procs, same as `io` (exported by the system module). Except the system module also has slurp/staticRead and gorge/staticExec, which are simple magics for reading files and executing processes in compile time thanks to the compiler. What I'm asking is, could there ever be a `staticTime` proc analog to `times.getTime`, or will we have to use a compile time FFI feature when/if it arrives? It is technically possible to use `staticExec` in current Nim for the same task but it seems too resource demanding. A hook like `staticTime` would be useful for things like benchmarking macros, NimScript etc. This feels like it should have been discussed before and I do remember it being discussed specifically for NimScript, but I just can't find anything on it.
Re: Nested list comprehension
Hi, I encountered "Error: undeclared identifier: 'collect'"
Re: FFI: how to avoid naming arguments in C functions
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: Like C extern pragma?
Use `when not declared` instead of `when not defined` and stop using UPPERCASE for variables, Nim has no preprocessor.
Re: Like C extern pragma?
I use this hack: when not defined IS_SUPPORT_IMPORTED: var IS_SUPPORT_IMPORTED {.compileTime.} : bool = true Run But nim (I use nimble package/project manager) complain about IS_SUPPORT_IMPORTED is defined twice. > /home/postep2/src/posteppkg/utility/includes/support.nim(20, 7) Error: > redefinition of 'IS_SUPPORT_IMPORTED'; previous declaration here: > /home/postep2/src/posteppkg/utility/includes/support.nim(20, 7)| > ---|---
Re: FFI: how to avoid naming arguments in C functions
Well alternatively you can read c2nim's documentation.
Re: FFI: how to avoid naming arguments in C functions
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 /usr/gr/lib/libGR.so(1, 1) Error: invalid token (\127) so probably I am not using it well. I write some spaguetty code in python to create the wrapper.
Re: FFI: how to avoid naming arguments in C functions
> 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
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) {.importc,dynlib: libName.} proc gr_axes*(a:cdouble, b:cdouble, c:cdouble, d:cdouble, e:cint, f:cint, g:cdouble){.importc,dynlib: libName.} proc gr_tick*(a:cdouble, b:cdouble):cdouble{.importc,dynlib: libName.} proc gr_beginprint*(a:cstring){.importc,dynlib: libName.} proc gr_endprint*(){.importc,dynlib: libName.} when isMainModule: let x = @[0.0, 0.2, 0.4, 0.6, 0.8, 1.0] let y = @[0.3, 0.5, 0.4, 0.2, 0.6, 0.7] let px = cast[ptr cdouble](unsafeAddr(x[0])) let py = cast[ptr cdouble](unsafeAddr(y[0])) gr_beginprint("salida.png".cstring) gr_polyline(x.len.cint, px, py) gr_axes(gr_tick(0, 1), gr_tick(0, 1), 0, 0, 1, 1, -0.01) gr_endprint() #discard readChar(stdin) Run gives me: (a big milestone for somebody like me)
FFI: how to avoid naming arguments in C functions
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 cdouble) {.importc,dynlib: libName.} Run where I have to add a, b, c just to make it work.