Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CoreFoundation] Make P/Invokes in CFSocket have blittable signatures. #20162

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/CoreFoundation/CFSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,17 +456,17 @@ public CFSocket (AddressFamily family, SocketType type, ProtocolType proto, CFRu
internal CFSocket (CFSocketSignature sig, double timeout)
{
unsafe {
#if NET
Initialize (
CFRunLoop.Current,
(CFSocketContext* ctx) => CFSocketCreateConnectedToSocketSignature (IntPtr.Zero, ref sig, (nuint) (ulong) defaultCallbackTypes, &OnCallback, ctx, timeout)
);
(CFSocketContext* ctx) => {
CFSocketSignature localSig = sig;
#if NET
return CFSocketCreateConnectedToSocketSignature (IntPtr.Zero, &localSig, (nuint) (ulong) defaultCallbackTypes, &OnCallback, ctx, timeout);
#else
Initialize (
CFRunLoop.Current,
(CFSocketContext* ctx) => CFSocketCreateConnectedToSocketSignature (IntPtr.Zero, ref sig, (nuint) (ulong) defaultCallbackTypes, OnCallback, ctx, timeout)
);
return CFSocketCreateConnectedToSocketSignature (IntPtr.Zero, &localSig, (nuint) (ulong) defaultCallbackTypes, OnCallback, ctx, timeout);
#endif
}
);
}
}

Expand Down Expand Up @@ -496,13 +496,13 @@ void Initialize (CFRunLoop runLoop, CreateSocket createSocket)

#if NET
[DllImport (Constants.CoreFoundationLibrary)]
unsafe extern static IntPtr CFSocketCreateConnectedToSocketSignature (IntPtr allocator, ref CFSocketSignature signature,
unsafe extern static IntPtr CFSocketCreateConnectedToSocketSignature (IntPtr allocator, CFSocketSignature* signature,
nuint /*CFOptionFlags*/ callBackTypes,
delegate* unmanaged<IntPtr, nuint, IntPtr, IntPtr, IntPtr, void> callout,
CFSocketContext* context, double timeout);
#else
[DllImport (Constants.CoreFoundationLibrary)]
unsafe extern static IntPtr CFSocketCreateConnectedToSocketSignature (IntPtr allocator, ref CFSocketSignature signature,
unsafe extern static IntPtr CFSocketCreateConnectedToSocketSignature (IntPtr allocator, CFSocketSignature* signature,
nuint /*CFOptionFlags*/ callBackTypes,
CFSocketCallBack callout,
CFSocketContext* context, double timeout);
Expand Down
1 change: 0 additions & 1 deletion tests/cecil-tests/BlittablePInvokes.KnownFailures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ public partial class BlittablePInvokes {
"System.IntPtr CoreFoundation.CFPropertyList::CFPropertyListCreateData(System.IntPtr,System.IntPtr,System.IntPtr,System.UIntPtr,System.IntPtr&)",
"System.IntPtr CoreFoundation.CFPropertyList::CFPropertyListCreateWithData(System.IntPtr,System.IntPtr,System.UIntPtr,System.IntPtr&,System.IntPtr&)",
"System.IntPtr CoreFoundation.CFRunLoopSourceCustom::CFRunLoopSourceCreate(System.IntPtr,System.IntPtr,CoreFoundation.CFRunLoopSourceContext&)",
"System.IntPtr CoreFoundation.CFSocket::CFSocketCreateConnectedToSocketSignature(System.IntPtr,CoreFoundation.CFSocketSignature&,System.UIntPtr,method System.Void *(System.IntPtr,System.UIntPtr,System.IntPtr,System.IntPtr,System.IntPtr),CoreFoundation.CFSocketContext*,System.Double)",
"System.IntPtr CoreFoundation.CFUrl::CFURLCreateWithFileSystemPath(System.IntPtr,System.IntPtr,System.IntPtr,System.Boolean)",
"System.IntPtr CoreFoundation.DispatchData::dispatch_data_create_map(System.IntPtr,System.IntPtr&,System.UIntPtr&)",
"System.IntPtr CoreGraphics.CGEvent::CGEventCreateKeyboardEvent(System.IntPtr,System.UInt16,System.Boolean)",
Expand Down
Loading