私は次の構造を持っています:
~/Desktop/hellonode$ ls
build rs232.h testnode.js helloworld.cc helloworld.node rs232.c
とでrs232.h
:
int OpenComport(int, int);
しかし、ノード ネイティブ プラグインを作成して次のコードを使用しようとすると、次のようになります。
#include "rs232.h"
using namespace v8;
void init(Handle<Object> target) {
int cport_nr=0; /* /dev/ttyS0 (COM1 on windows) */
if(OpenComport(cport_nr, bdrate))
{
printf("Can not open comport\n");
return;
}
target->Set(String::NewSymbol("hello"),
FunctionTemplate::New(Method)->GetFunction());
}
node-waf を使用してプラグインをビルドします
すべてが正常にコンパイルされますが、実行しようとすると次のエラーが発生します。
~/Desktop/hellonode$ node testnode
node: symbol lookup error: <~>/Desktop/hellonode/build/Release/helloworld.node: undefined symbol: OpenComport