话不多说,先贴代码:#include#includenapi_value sayHello(napi_env env,napi_callback_info ci)
{
size_t lengthOfArguments=1;
napi_value args,thisPointer;
void *data;
napi_get_cb_info(env,ci,&lengthOfArguments;,&args;,&thisPointer;,&data;);
if (lengthOfArguments!=1)
{
return args;
}
size_t strlen;
napi_get_value_string_utf8(env,args,NULL,0,&strlen;);
char *buf=new char[strlen+1];
size_t res;
napi_get_value_string_utf8(env,args,buf,strlen+1,&res;);
std::cout<<
...
继续阅读
(50)