TooTallNate / ref

Turn Buffer instances into "pointers"
http://tootallnate.github.com/ref
453 stars 141 forks source link

how to ref c++ std::string type? #77

Closed hafeyang closed 6 years ago

hafeyang commented 7 years ago

how to ref c++ std::string type?

i have cpp code:

int initApiConfig(const std::string & configFile);

how to ref std::string

KongWeibin commented 7 years ago

You may try it like this: var Test = ffi.Library('test',{ 'init': ['void',['string','int']], 'hello': ['string', ['int']] }); good luck!

hafeyang commented 7 years ago

tried string but failed ;(

TooTallNate commented 7 years ago

FFI generally doesn't work great with C++ functions. You should write a C wrapper around that function and invoke that through FFI.