Not sure what the issue is with VOID
, need to see more code (such as, what is VOID
defined as).
About LPCSTR
, it is true that you can't convert. One way to do it would be to put what is explained on C++ LPCTSTR to char* in a wrapper function in your .i. The fact that it is a char**
indicates the C++ function will probably return a pointer to an internal string. Python doesn't know how to handle that so you should return a string instance. Example:
%inline %{
std::string myFunc() // don't use char** since
{
LPCTSTR pszA = ... create buffer for LPCSTR string
callYourMFCFunc(& pszA);
CStringA sB(pszA);
return std::string((const char*)sB);
}
%}
I haven't tested the above, it is my best guess based on that SO post so you might have to fix a bit but you get the idea. SWIG's %inline
and %extend
directives allow you to completely adapt one API to another (in this case, change a function that takes a char** as arg into a function that returns a string).