#655 closed Feature Request (Rejected)
Suggestion: DllCall for pointers
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | Severity: | None | |
| Keywords: | DllCall pointer | Cc: |
Description
What about calling functions with their pointer?
Now we can create DLLCallBack functions, but not call them out of other DLLs.
Why not change the DLLCall to support them, e.g. if DLL is empty then the function name could be the Pointer.
$MOD = _WinAPI_LoadLibrary("Any.dll")
$TheFuncPtr = DllCall("Kernel32.dll","ptr","GetProcAddress","hwnd",$MOD,"str","FuncName")
$TheFuncPtr = $TheFuncPtr[0]
DllCall("", "none", $TheFuncPtr, "hwnd", $param1, "long", $param2)
Attachments (0)
Change History (4)
comment:1 by , 17 years ago
| Resolution: | → Rejected |
|---|---|
| Status: | new → closed |
comment:3 by , 16 years ago
I'd like to lobby that this feature request be reconsidered. This would be useful functionality for calling functions from DLLs embedded and loaded to memory (MemoryDll UDF) or for object function pointers (as in the AutoItObject project). In the latter case, you can still manually do this without AIO by creating the object vtables, but you are still left with only function pointers and no native way to call them.
There are workarounds for this, like in the MemoryDll UDF and AutoItObject, but none are very pretty.
This should be trivial to implement unless I'm mistaken, just skip the LoadLibrary/GetProcAddress steps in the DllCall process. No?
comment:4 by , 15 years ago
I'd really like to see this feature. Now there is even a libTCC-libary for AutoIt where you need to call a function by its pointer.
It shouldn't be too difficult to check the whether the tpye of the function name is pointer in order to choose between LoadLibrary/GetProcAddress and pointer call.

I'm astounded, truly. Did you even bother to think about how DllCall() might work for even a moment? Clearly not. There is no reason to call a function by pointer because as your code demonstrates in order to get a pointer you have to call LoadLibrary() and GetProcAddress() which is what DllCall() does already.