[squeak-dev] FFI windows API examples

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Mon Aug 22 14:27:49 UTC 2022

After working around Win32Window externalType with light surgery (in plain
English, this translates to heavy butchery), the next hurdle is that
    (Win32Window on: Win32Window getFocus) getDC.
will trigger an Error (could not coerce arguments).
I cannot pass a Win32Window to <apicall: Win32HDC 'GetDC' (Win32Window)
module: 'user32.dll'>
I cannot pass its value either...
I'm really stuck here.
Most of my FFI stuff rely on using type aliases and is currently
dysfunctional, so having a basic example working might be helpful...

Le lun. 22 août 2022 à 15:02, Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com> a écrit :

> Hmm, I naivly tried (Wind32Handle allSubclassesDo: #doneCompiling) but
> it's not sufficient, Win32Window new still returns a Win32Handle.
> It seems that what triggers #generateTypeAccessor is a query to
> (SomeExternalStructureSubclass externalType).
> But if we already queried (SomeExternalStructureSubclasUpperInHierarchy
> externalType), then externalType will be inherited from this intermediate
> subclass, not from ExternalStructure, and thus #generateTypeAccessor won't
> be triggered...
> Le lun. 22 août 2022 à 14:43, Nicolas Cellier <
> nicolas.cellier.aka.nice at gmail.com> a écrit :
>> Hi all,
>> in recent FFI, I tried to evaluate the example in Win32Window comment.
>> I would expect (Win32Window getFocus) to return an instance of
>> Win32Window.
>> But it returns a (Small)Integer.
>> Using (Win32Window new value: Win32Window getFocus) as a workaround does
>> not work either, we cannot send getDC to it, because Win32Window new
>> returns an instance of Win32Handle, not Win32Window... Because externalType
>> has not been (*auto)generated for subclasses of Win32Handle... Probably
>> because they have no (MC) method definition recognized as
>> isExternalStructureFieldDefinition...
>> How to make simple examples like this work?
>> Nicolas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220822/28edaeaf/attachment.html>

More information about the Squeak-dev mailing list