I just have simply more experience with `nimterop` (the first one I used), and 
now I end up using most of the times `c2nim`. Given that sometimes both fails I 
end up using `c2nim` and `nimterop` in order to get inspiration about how to 
get thinks working.

I tried `cinterop` once, but I think it is only worth it when you are 
interested in using only a small portion from a library.

Regarding `futhark`, I have never tried it. I just tried the following:
    
    
    import futhark
    
    importc:
      path "/usr/include/leptonica"
      "allheaders.h"
    
    {.passL:"-lleptopnica".}
    
    var inputPix = pixRead("/home/jose/docs/scanned/salida.png".cstring)
    
    var rotatedPix = pixRotate90(inputPix, 1.cint)
    
    discard pixWrite("rotated_image.jpg".cstring, rotatedPix, 
IFF_JFIF_JPEG.cint)
    
    
    Run

But it fails with:
    
    
    ➜  src nim c leptonica.nim
    Hint: used config file 
'/home/jose/.choosenim/toolchains/nim-2.0.2/config/nim.cfg' [Conf]
    Hint: used config file 
'/home/jose/.choosenim/toolchains/nim-2.0.2/config/config.nims' [Conf]
    
..............................................................................................................................................
    
/home/jose/.nimble/pkgs2/futhark-0.12.2-cd781cfc8519fb2353979af90972e6749ab5a3ac/futhark.nim(716,
 7) Hint: Running: opir -I/usr/include/leptonica -I/usr/lib/clang/16/include 
/home/jose/.cache/nim/leptonica_d/futhark-includes.h [User]
    
/home/jose/.nimble/pkgs2/futhark-0.12.2-cd781cfc8519fb2353979af90972e6749ab5a3ac/futhark.nim(734,
 3) Hint: Parsing Opir output [User]
    stack trace: (most recent call last)
    
/home/jose/.nimble/pkgs2/futhark-0.12.2-cd781cfc8519fb2353979af90972e6749ab5a3ac/futhark.nim(738,
 13) importcImpl
    /home/jose/.choosenim/toolchains/nim-2.0.2/lib/pure/json.nim(1040, 23) 
parseJson
    /home/jose/.choosenim/toolchains/nim-2.0.2/lib/pure/json.nim(953, 4) 
parseJson
    /home/jose/.choosenim/toolchains/nim-2.0.2/lib/pure/parsejson.nim(113, 15) 
open
    /home/jose/.choosenim/toolchains/nim-2.0.2/lib/pure/lexbase.nim(150, 13) 
open
    /home/jose/.choosenim/toolchains/nim-2.0.2/lib/pure/lexbase.nim(89, 32) 
fillBuffer
    /home/jose/.choosenim/toolchains/nim-2.0.2/lib/pure/streams.nim(254, 31) 
readDataStr
    /home/jose/.choosenim/toolchains/nim-2.0.2/lib/pure/streams.nim(1219, 50) 
ssReadDataStr
    /home/jose/.choosenim/toolchains/nim-2.0.2/lib/system/indices.nim(86, 12) []
    /home/jose/src/nimlang/leptonica_futhark/src/leptonica.nim(3, 1) 
template/generic instantiation of `importc` from here
    
/home/jose/.nimble/pkgs2/futhark-0.12.2-cd781cfc8519fb2353979af90972e6749ab5a3ac/futhark.nim(660,
 14) template/generic instantiation of `importcImpl` from here
    /home/jose/.choosenim/toolchains/nim-2.0.2/lib/system/indices.nim(86, 12) 
Error: interpretation requires too many iterations; if you are sure this is not 
a bug in your code, compile with `--maxLoopIterationsVM:number` (current value: 
10000000)
    
    
    Run

I don't know if I am using it correctly.

I think futhark would benefit from having links to some working examples. If 
you look at `nimterop`, they have 
[this](https://github.com/nimterop/nimterop/wiki/Wrappers) that can serve as 
inspiration. 

Reply via email to