Re: [python-win32] Implementing an instance of an external/physical .dll file?
On Jan 19, 2015, at 1:20 PM, Jacob Kruger 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
Re: [python-win32] Implementing an instance of an external/physical .dll file?
- 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.? Let me caution you, however, that the DLL in that release is a 32-bit DLL. If you are using 32-bit Python, you're OK. If you're using 64-bit Python, you can't use the binary. You'd have to build it from source. I specifically stick to 32-bit python, in case it will affect target, etc. -- Tim Roberts, t...@probo.com 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? So, something along the lines of referring to it using it's ProgID: #start code import win32com.client spk = win32com.client.Dispatch("Say.Tools") spk.Say("hello world") #end code Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32
Re: [python-win32] Implementing an instance of an external/physical .dll file?
Jacob Kruger wrote: > I have a .dll pulled from following hub: > https://github.com/qtnc/UniversalSpeech > > What's the easiest/simplest way to then implement/instantiate an > instance of it working via file path? > > If possible, and, currently working with python 3.4, on a windows7 64 > bit machine, FWIW. 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. Let me caution you, however, that the DLL in that release is a 32-bit DLL. If you are using 32-bit Python, you're OK. If you're using 64-bit Python, you can't use the binary. You'd have to build it from source. -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32
[python-win32] Implementing an instance of an external/physical .dll file?
I have a .dll pulled from following hub: https://github.com/qtnc/UniversalSpeech What's the easiest/simplest way to then implement/instantiate an instance of it working via file path? If possible, and, currently working with python 3.4, on a windows7 64 bit machine, FWIW. Stay well Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." ___ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32