7 ms·
I’m seeing in-line x86 assembly encoded as floating-point constants, implementing what looks like indirect function calls (function pointers?). Is this…normal f
by nneonneo 3y ago
I’m seeing in-line x86 assembly encoded as floating-point constants, implementing what looks like indirect function calls (function pointers?). Is this…normal for advanced VB code? Does VB6 not have any other mechanism for function pointers?
- DaiPlusPlus 3y ago> Does VB6 not have any other mechanism for function pointers? Not really: https://www.codeproject.com/Articles/19239/Compilers-Demystified-Function-Pointers-in-Visual https://www.codeproject.com/Articles/19239/Compilers-Demysti... COM interfaces might count, but that's more of a reference to a COM object which can have many member methods besides a single function (though the concept of using only interface-types to pass around function-pointers is Java's chosen approach, and I don't know anyone who still maintains this was a good idea...)
- _glass 3y agoI used to pass functions by just creating a class making a noun of a verb, i.e. I passed objects.
- electroly 3y agoYou can use the "AddressOf" operator to get a function pointer, but it can only be used to pass to native (Win32) functions. This is how you do things like implementing your own WndProc function. VB itself can't call through the resulting function pointer.
- int_19h 3y agoThe trick was to use some Win32 API function that is guaranteed to invoke the callback right away with the arguments that you specify explicitly. CallWindowProc was the usual go-to for that.