I was using _c2nim_ to do the conversion and since I wasn't providing the 
_\--header_ flag, it wasn't putting in the _{.importcpp.}_ pragma itself. A 
global _{.push importcpp.}_ wasn't working since these were under the _fts_ 
namespace. For some reason, it was thinking _fuzzy_match()_ was a proc without 
a namespace even though the .h file is clear about that.

Turns out, the following command works well and does the needful.

> c2nim --cpp --header:headernimfuzz fts_fuzzy_match.h

Generated output is as follows. The _const_ line defining the header file was 
added after the fact. Should give an idea of how to get this working in general 
when wrapping C++ code.
    
    
    const headernimfuzz = "fts_fuzzy_match.h"
    proc fuzzy_match_simple*(pattern: cstring; str: cstring): bool {.
        importcpp: "fts::fuzzy_match_simple(@)", header: headernimfuzz.}
    proc fuzzy_match*(pattern: cstring; str: cstring; outScore: var cint): bool 
{.
        importcpp: "fts::fuzzy_match(@)", header: headernimfuzz.}
    proc fuzzy_match*(pattern: cstring; str: cstring; outScore: var cint;
                     matches: ptr uint8; maxMatches: cint): bool {.
        importcpp: "fts::fuzzy_match(@)", header: headernimfuzz.}
    

The 
[manual](https://nim-lang.org/docs/manual.html#importcpp-pragma-importcpp-for-procs)
 was also good about this.

Thanks for the help.

Reply via email to