On Jan 19, 2015, at 1:20 PM, Jacob Kruger <ja...@blindza.co.za> wrote:
> 
> ----- Original Message -----
>> You can use the ctypes module to access virtually any arbitrary DLL.
>> That's what they mean when they talk about an FFI library.  There's a
>> learning curve, but essentially anything is possible.
> 
> Ok, both of the following code snippets execute without any errors/issues:
> from ctypes import *
> import os
> #first one
> uS = windll.LoadLibrary(os.path.realpath("UniversalSpeech.dll"))
> 
> #second one
> uSc = cdll.LoadLibrary(os.path.realpath("UniversalSpeech.dll"))
> #end code
> 
> But, issue then is that am really not sure how to then work with 
> functions/methods 'exposed' by the instance/DLL, since if look at some of 
> the ctypes tutorial material, it seems like you need to already know exactly 
> what the .dll offers, etc., to then set up/implement wrappers/pointers to 
> things like functions, etc.?

Yes, of course you do.  You can’t possibly expect to use a DLL without knowing 
how to use it.  Unless someone has already done so, you will have to translate 
the C prototypes for all of the DLL’s exported functions into Python ctypes 
declarations (or, at least, the functions you need to use).


> But, for example, when working with another alternative that has been 
> registered on system, and then using win32com.client, can just make function 
> calls, etc., but, think that one relates to that .dll having been run 
> through an effective regsvr32?

Yes, for DLLs that are COM servers, the DLL (or its type library) contains 
enough information about the parameters and parameter types that the win32com 
module can automatically generate the Python code to convert between them.  
This DLL is not a COM server, so you have to do all of that by hand..
— 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

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

Reply via email to