ysystudio wrote:
> I have a windows dll1.dll with a export function:
>  
> int f1(char filename,char **buf,int *bufLen)
> {
> int len;
> //got the length of file anyway,such as 100
> len = 100;//len = getLen(filename);
> *buf = (char*)calloc(100);
> *bufLen = len;
> return 0;
> }
>  
> then how can I call the f1 function with python.

I assume this is just an example, because this is not a good way to
design a DLL.  It is never a good idea to allocate memory in one DLL and
pass it to another, because they might be using different C runtime
libraries.  If you need to fill in a string, you should allocate the
buffer in the calling program, then hand in the buffer and the length to
let the DLL fill it in.

In general, you use the ctypes module to call into foreign DLLs.  The
details depend strongly on the parameters.  If you could be a little
more specific about what you need, we could provide better advice.

-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to