From: John P. <jpo...@gm...> - 2010-07-14 07:14:56
|
Hi SWIG Experts, I'm currently attempting to use SWIG 2.0 to wrap C++ for use in Lua. I have the following function i'm attempting to wrap: // LuaTest.cpp int Foo(char** s) { *s = (char *) malloc(64); sprintf(*s, "Hello world\n"); return 1; } Initially, the SWIG interface file contained the following: // luaTest.i %include "cstring.i" %cstring_output_allocate(char **s, free(*$1)); However, while attempting to create the wrapper, SWIG output: *swig.exe -c++ -lua luaTest.i cstring.i not implemented for this target* Ideally, from Lua I'd like to call the function as: *retInt, retStr = luaTest.Foo()* where retStr would contain "Hello World". Is this there an alternative to cstring_output_allocate to achieve this? Thanks! - John |