[squeak-dev] FFI windows API examples

Marcel Taeumel marcel.taeumel at hpi.de
Tue Aug 23 08:50:05 UTC 2022


Hi Nicolas --

I will have a look at it. It's nice to see you having a try with SqueakFFI again. We might want to have another chat about coercing and type checking in the plugin. That's the biggest construction site at the moment. Hopefully, the image-side is more prepared for this now

Best,
Marcel
Am 22.08.2022 16:28:14 schrieb Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
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 [mailto: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 [mailto: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/20220823/dff0fb50/attachment.html>


More information about the Squeak-dev mailing list