You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Investigate whether it's beneficial to share P/Invokes with similar signatures #16673
P_1 is a [Native] enum, which is an n[u]int so it can have a different size on 32/64 bits architectures.
An IntPtr can also do this job and since we're already using them in many places (handles) we have a better chance to share an existing signature for objc_msg[Super]Send
e.g. void_objc_msgSend_IntPtr_IntPtr already exists
I wonder if we can use function signatures to completely get rid of all the overloads...
[DllImport("libc")]staticexternvoidobjc_msgSend();internalunsafestaticclassMessagingFunctions{staticvoid*GetFunctionPointer(){delegate* unmanaged<void>func=&objc_msgSend;return(void*)func;}staticdelegate* unmanaged<IntPtr>GetFunction_IntPtr(){delegate* unmanaged<void>func=&objc_msgSend;return(delegate* unmanaged<IntPtr>)(void*)func;}}// and then called like:varmsgSend=MessagingFunctions.GetFunction_IntPtr();varhandle=msgSend(this.Handle,Selector.GetHandle("init"));
Activity
rolfbjarne commentedon Nov 9, 2022
I wonder if we can use function signatures to completely get rid of all the overloads...
Therzok commentedon Nov 9, 2022
I think the latter proposal will work if all CPU architectures pass return values in registers, and not on the stack.
rolfbjarne commentedon Nov 9, 2022
We'd still need to call the right
objc_msgSend[_stret|_fpret]function.