I'm trying to wrap a C++ module but having some trouble with compilation. Any 
help will be appreciated.

File I'm wrapping: 
[link](https://github.com/forrestthewoods/lib_fts/blob/master/code/fts_fuzzy_match.h).
 It contains the implementation code as well.

The wrapped fts_fuzzy_match.nim contents:
    
    
    {.push importcpp.}
    {.push header: "fts_fuzzy_match.h".}
    {.compile: "nimfuzz/fts_fuzzy_match.h".}
    proc fuzzy_match_simple*(pattern: cstring; str: cstring): bool
    proc fuzzy_match*(pattern: cstring; str: cstring; outScore: var cint): bool
    proc fuzzy_match*(pattern: cstring; str: cstring; outScore: var cint;
                     matches: ptr uint8; maxMatches: cint): bool
    {.pop.}
    {.pop.}
    

The test.nim file:
    
    
    import fts_fuzzy_match
    
    var i: cint = 0
    echo fuzzy_match("ftw", "ForrestTheWoods", i)
    echo i
    

The error when I compile with 
    
    
    > nim cpp --passC:"-DFTS_FUZZY_MATCH_IMPLEMENTATION" test.nim
    
    
    tests\nimcache\nimfuzz_test.cpp: In function 'void NimMainModule()':
    tests\nimcache\nimfuzz_test.cpp:143:14: error: request for member 
'fuzzy_match' in '"ftw"', which is of non-class type 'const char [4]'
      T1_ = "ftw".fuzzy_match("ForrestTheWoods", i_9c2pue6RWUiHyC8NB9amjv0Q);
                  ^~~~~~~~~~~
    

Thanks in advance.

Reply via email to