Hello,

I consider myself a newish nim programmer with some success and some failures. 
I had yet to dabble in the FFI and started tinkering around with it. I have an 
external `.dylib` and its corresponding `.h`. I am attempting to test out 
calling from `nim`. I think everything has been going ok until I encountered an 
`int *`.

What can I use in nim to pass as the equivalent `C` type?

Any thoughts or help on this would be greatly appreciated.

**C Declaration**
    
    
    int Api_Version_V2(char *version, int *length);
    
    
    Run

**Nim Code**
    
    
    const MY_LIB = "api.dylib"
    
    proc Api_Version_V2(version: cstring, length: ???): cint {.importc, dynlib: 
MY_LIB, header: "Api.h", discardable.}
    
    proc getVersion(): string =
      result = newString(64)
      Api_Version_V2(result.cstring, ???)
      result = $(result.cstring)
    
    echo getVersion()
    
    
    Run

**Run Snippet**

`nim c -p:./ -r CallC.nim -d:nimDebugDlOpen`

Reply via email to