Generating python wrapper for 3ed party c++ dll using swig with

Posted by MuraliK on Stack Overflow See other posts from Stack Overflow or by MuraliK
Published on 2012-11-29T05:00:32Z Indexed on 2012/11/29 5:03 UTC
Read the original article Hit count: 189

Filed under:

I am new bee to swig. I have a third party c++ dll with the following functions export. I want to call these dll functions in python. So thought of using swig to generate the wrapper using swig. I am not sure what sort of wrapper i need to generate (do i need to generate .lib or .dll to use it in python?). In case i need to generate .dll how do i do that using visual studio 2010. There are some call back function like SetNotifyHandler(void (__stdcall * nf)(int wp, void *lp)) in the bellow list. How do define such function in interface file. can someone help me plese?

enter code here
#ifndef DLL_H
#define DLL_H

#ifdef DLL_BUILD
#define DLLFUNC __declspec(dllexport)
#else
#define DLLFUNC __declspec(dllimport)
#endif

#pragma pack(push)
#pragma pack(1)
#pragma pack(pop)

extern "C" {
DLLFUNC int __stdcall StartServer(void);
DLLFUNC int __stdcall GetConnectionInfo(int connIndex, Info *buf); 
DLLFUNC void __stdcall SetNotifyWindow(HWND nw);
DLLFUNC void __stdcall  SetNotifyHandler(void (__stdcall * nf)(int wp, void *lp));
DLLFUNC int  __stdcall  SendCommand(int connIndex, Command *cmd);
};

© Stack Overflow or respective owner

Related posts about swig