我一直在关注使用 Swig 将 C 与 TCL 结合起来的教程。该教程似乎工作正常,但最后我遇到了一个我无法解决的错误。情况如下:
我关注的教程是: http ://www.swig.org/tutorial.html 。
我有一个名为 test.c 的文件:
char *HelloWorld()
{
return "hello world";
}
和另一个名为 test.i:
%module test
%{
/* Put header files here or function declarations like below */
extern char *HelloWorld();
%}
extern char *HelloWorld();
然后我使用以下命令行参数来准备正确的文件:
gcc -c test.c -o test.o
swig -tcl test.i
gcc -c test_wrap.c -o test_wrap.o
gcc -dynamiclib -framework Tcl test.o test_wrap.o -o test.so
最后我尝试使用以下方法加载它:
tclsh
% load test.so test
这是我收到以下错误的地方:
dlsym(0x100600090, Test_Unload): symbol not founddlsym(0x100600090, Test_SafeUnload): symbol not found
据我所知,我没有偏离教程。谁能告诉我我是怎么得到这个错误的,更重要的是如何摆脱它?
提前致谢!