Hi,
Another question, what i do now is wrap all functions in DLL
again like this:
// this is header file for DLL
void func(void)
{
...
}
// this is my .cpp file for swig
#pragma comment(lib, "TEVlib.lib")
void _func(void)
{
func() // this is the func of DLL
}
// this is .i file
%inline{
extern void _func(void);
%}
I just wonder if it is possible that we can generate a .py
file
directly from the header file of DLL with all functions
exposed? I
think that can save a lot of time. I have tried without
success.
On 4/27/07, Bruce Who <bruce.who.hk gmail.com> wrote:
> Hi, all
>
> I have a DLL and related .lib and .h files provided by
3rd party, and
> I want to make a python extension module from this dll
I tried swig
> but failed.
>
> At first , I just used this command:
>
> swig -python -module TEVLib TEVLib.h
>
> I got a TEVLib.py file, but it did not work of course.
So I tried
> another method: I wrote TEV.c and TEV.i, this TEV.c
just wrappered all
> functions from TEVLib and included all necessary .h
files and also
> included this statement
>
> #pragma comment(lib, "TEVLib.lib")
>
> Then I compiled all of these and got TEVLib.py and
_TEVLib.pyd, but
> when I tried to import it, error occured, it's said
something like
> that the DLL could not be imported.
>
> I know that we can use ctypes to call functions in dll,
but I just get
> bored with defining function prototypes with CFUNCTYPE.
That's why I
> choose swig.
>
> As a newbie, I just do not know why it doesnot work.
Could somebody
> help me out?Thanks in advance.
>
Bruce
------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Boost-langbinding mailing list
Boost-langbinding lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/boost
-langbinding
|