----- Original Message -----
From: "Thomas Heller" <theller@...>
To: <ctypes-users@...>
Sent: Sunday, March 12, 2006 5:51 AM
Subject: [ctypes-users] Re: Accessing DLL functions by ordinal
> Luke Dunstan wrote:
>>
>> ----- Original Message ----- From: "Thomas Heller" <theller@...>
>> To: <ctypes-users@...>
>> Sent: Saturday, March 11, 2006 5:05 AM
>> Subject: [ctypes-users] Re: Accessing DLL functions by ordinal
>>
>>
>>> Thomas Heller wrote:
>>>> Luke Dunstan wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Is it possible to use functions in a DLL when they have been exported
>>>>> by ordinal only, with ctypes?
>>>>
>>>> Not officially. Although you can of course call GetProcAddress
>>>> yourself.
>>>>
>>>>> On Windows CE most functions work fine but I have found at least a
>>>>> couple that are apparently exported by ordinal and not by name. For
>>>>> example, "SHHandleWMActivate" in "aygshell.dll" can only be accessed
>>>>> as ordinal 84 (the ordinal was determined using "dumpbin /all
>>>>> aygshell.lib").
>>>>>
>>>>> If this is not possible then I would like to see this feature added to
>>>>> ctypes.
>>>>
>>>> Yes, I'll add it - but probably not before the next release. The
>>>> constructor
>>>> signature of _CFuncPtr has to change for that.
>>>
>>> Accessing functions by ordinal (on Windows) is implemented in CVS right
>>> now.
>>> If you want to play with it, you should get the HEAD branch (I moved
>>> everything
>>> into HEAD and continued development there. Also large cleanups have
>>> been made
>>> for the core Python import - more on that later).
>>>
>>> The _CFuncPtr signature has changed to implement this more or less
>>> cleanly, see
>>> the changelog for more details. Since _CFuncPtr is private, it should
>>> not make
>>> any problems. Accessing a function by ordinal is via getitem:
>>>
>>> mydll = WinDLL("foobar")
>>> func = mydll[42]
>>>
>>> Thomas
>>
>> I should have mentioned it earlier, but _ctypes.vcp and _ctypes_test.vcp
>> are in the same directory and use the same build subdirectories (e.g.
>> "ARMV4Dbg"). Both builds can generate "vc60.pdb" and I don't know what
>> the effect will be of having them in the same directory, so either
>> _ctypes_test.vcp should be moved into a subdirectory or it should be
>> modified to use different directories.
>
> I've never used to build a debug version or had to debug it so I don't
> know either.
> Would you like to make the needed changes yourself?
>
> Thanks,
>
> Thomas
I've moved it into a subdirectory because that is the usual practice for
MSVC. By the way, accessing the functions by ordinal works nicely.
Thanks,
Luke
|