[src] Make a few P/Invokes stragglers have blittable signatures. (#20675)
Contributes towards #15684.
This commit is contained in:
Родитель
aa25b1e191
Коммит
05a9b0872f
|
@ -88,7 +88,11 @@ namespace AudioUnit {
|
||||||
|
|
||||||
static IntPtr Create ()
|
static IntPtr Create ()
|
||||||
{
|
{
|
||||||
int err = NewAUGraph (out var handle);
|
IntPtr handle;
|
||||||
|
int err;
|
||||||
|
unsafe {
|
||||||
|
err = NewAUGraph (&handle);
|
||||||
|
}
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
throw new InvalidOperationException (String.Format ("Cannot create new AUGraph. Error code: {0}", err));
|
throw new InvalidOperationException (String.Format ("Cannot create new AUGraph. Error code: {0}", err));
|
||||||
return handle;
|
return handle;
|
||||||
|
@ -101,7 +105,10 @@ namespace AudioUnit {
|
||||||
|
|
||||||
public static AUGraph? Create (out int errorCode)
|
public static AUGraph? Create (out int errorCode)
|
||||||
{
|
{
|
||||||
errorCode = NewAUGraph (out var handle);
|
IntPtr handle;
|
||||||
|
unsafe {
|
||||||
|
errorCode = NewAUGraph (&handle);
|
||||||
|
}
|
||||||
|
|
||||||
if (errorCode != 0)
|
if (errorCode != 0)
|
||||||
return null;
|
return null;
|
||||||
|
@ -483,7 +490,7 @@ namespace AudioUnit {
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport (Constants.AudioToolboxLibrary, EntryPoint = "NewAUGraph")]
|
[DllImport (Constants.AudioToolboxLibrary, EntryPoint = "NewAUGraph")]
|
||||||
static extern int /* OSStatus */ NewAUGraph (out IntPtr outGraph);
|
unsafe static extern int /* OSStatus */ NewAUGraph (IntPtr* outGraph);
|
||||||
|
|
||||||
[DllImport (Constants.AudioToolboxLibrary, EntryPoint = "AUGraphOpen")]
|
[DllImport (Constants.AudioToolboxLibrary, EntryPoint = "AUGraphOpen")]
|
||||||
static extern int /* OSStatus */ AUGraphOpen (IntPtr inGraph);
|
static extern int /* OSStatus */ AUGraphOpen (IntPtr inGraph);
|
||||||
|
|
|
@ -138,10 +138,21 @@ namespace ObjCRuntime {
|
||||||
[DllImport (Messaging.LIBOBJC_DYLIB)]
|
[DllImport (Messaging.LIBOBJC_DYLIB)]
|
||||||
extern static /* const char* */ IntPtr sel_getName (/* SEL */ IntPtr sel);
|
extern static /* const char* */ IntPtr sel_getName (/* SEL */ IntPtr sel);
|
||||||
|
|
||||||
|
// objc/runtime.h
|
||||||
|
[DllImport (Messaging.LIBOBJC_DYLIB)]
|
||||||
|
extern static /* SEL */ IntPtr sel_registerName (/* const char* */ IntPtr name);
|
||||||
|
|
||||||
// objc/runtime.h
|
// objc/runtime.h
|
||||||
// Selector.GetHandle is optimized by the AOT compiler, and the current implementation only supports IntPtr, so we can't switch to NativeHandle quite yet (the AOT compiler crashes).
|
// Selector.GetHandle is optimized by the AOT compiler, and the current implementation only supports IntPtr, so we can't switch to NativeHandle quite yet (the AOT compiler crashes).
|
||||||
[DllImport (Messaging.LIBOBJC_DYLIB, EntryPoint = "sel_registerName")]
|
public static IntPtr GetHandle (string name)
|
||||||
public extern static /* SEL */ IntPtr GetHandle (/* const char* */ string name);
|
{
|
||||||
|
var ptr = Marshal.StringToHGlobalAnsi (name);
|
||||||
|
try {
|
||||||
|
return sel_registerName (ptr);
|
||||||
|
} finally {
|
||||||
|
Marshal.FreeHGlobal (ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// objc/objc.h
|
// objc/objc.h
|
||||||
[DllImport (Messaging.LIBOBJC_DYLIB)]
|
[DllImport (Messaging.LIBOBJC_DYLIB)]
|
||||||
|
|
|
@ -1206,7 +1206,7 @@ namespace Security {
|
||||||
[SupportedOSPlatform ("maccatalyst")]
|
[SupportedOSPlatform ("maccatalyst")]
|
||||||
#endif
|
#endif
|
||||||
[DllImport (Constants.SecurityLibrary)]
|
[DllImport (Constants.SecurityLibrary)]
|
||||||
static extern /* CFDataRef _Nullable */ IntPtr SecKeyCreateEncryptedData (/* SecKeyRef */ IntPtr key, /* SecKeyAlgorithm */ IntPtr algorithm, /* CFDataRef */ IntPtr plaintext, /* CFErrorRef* */ out IntPtr error);
|
unsafe static extern /* CFDataRef _Nullable */ IntPtr SecKeyCreateEncryptedData (/* SecKeyRef */ IntPtr key, /* SecKeyAlgorithm */ IntPtr algorithm, /* CFDataRef */ IntPtr plaintext, /* CFErrorRef* */ IntPtr* error);
|
||||||
|
|
||||||
#if NET
|
#if NET
|
||||||
[SupportedOSPlatform ("tvos")]
|
[SupportedOSPlatform ("tvos")]
|
||||||
|
@ -1219,7 +1219,11 @@ namespace Security {
|
||||||
if (plaintext is null)
|
if (plaintext is null)
|
||||||
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (plaintext));
|
ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (plaintext));
|
||||||
|
|
||||||
var data = SecKeyCreateEncryptedData (Handle, algorithm.GetConstant ().GetHandle (), plaintext.Handle, out var err);
|
IntPtr data;
|
||||||
|
IntPtr err;
|
||||||
|
unsafe {
|
||||||
|
data = SecKeyCreateEncryptedData (Handle, algorithm.GetConstant ().GetHandle (), plaintext.Handle, &err);
|
||||||
|
}
|
||||||
error = Runtime.GetNSObject<NSError> (err);
|
error = Runtime.GetNSObject<NSError> (err);
|
||||||
return Runtime.GetNSObject<NSData> (data, true);
|
return Runtime.GetNSObject<NSData> (data, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,9 +27,6 @@ namespace Cecil.Tests {
|
||||||
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSend(System.IntPtr,System.IntPtr)",
|
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSend(System.IntPtr,System.IntPtr)",
|
||||||
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSendSuper_stret(System.IntPtr,System.IntPtr)",
|
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSendSuper_stret(System.IntPtr,System.IntPtr)",
|
||||||
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSendSuper(System.IntPtr,System.IntPtr)",
|
"AVFoundation.AVSampleCursorSyncInfo ObjCRuntime.Messaging::AVSampleCursorSyncInfo_objc_msgSendSuper(System.IntPtr,System.IntPtr)",
|
||||||
"System.Int32 AudioUnit.AUGraph::NewAUGraph(System.IntPtr&)",
|
|
||||||
"System.IntPtr ObjCRuntime.Selector::GetHandle(System.String)",
|
|
||||||
"System.IntPtr Security.SecKey::SecKeyCreateEncryptedData(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr&)",
|
|
||||||
"System.Void ObjCRuntime.Messaging::void_objc_msgSend_GCDualSenseAdaptiveTriggerPositionalAmplitudes_float(System.IntPtr,System.IntPtr,GameController.GCDualSenseAdaptiveTriggerPositionalAmplitudes,System.Single)",
|
"System.Void ObjCRuntime.Messaging::void_objc_msgSend_GCDualSenseAdaptiveTriggerPositionalAmplitudes_float(System.IntPtr,System.IntPtr,GameController.GCDualSenseAdaptiveTriggerPositionalAmplitudes,System.Single)",
|
||||||
"System.Void ObjCRuntime.Messaging::void_objc_msgSend_GCDualSenseAdaptiveTriggerPositionalResistiveStrengths(System.IntPtr,System.IntPtr,GameController.GCDualSenseAdaptiveTriggerPositionalResistiveStrengths)",
|
"System.Void ObjCRuntime.Messaging::void_objc_msgSend_GCDualSenseAdaptiveTriggerPositionalResistiveStrengths(System.IntPtr,System.IntPtr,GameController.GCDualSenseAdaptiveTriggerPositionalResistiveStrengths)",
|
||||||
"System.Void ObjCRuntime.Messaging::void_objc_msgSendSuper_GCDualSenseAdaptiveTriggerPositionalAmplitudes_float(System.IntPtr,System.IntPtr,GameController.GCDualSenseAdaptiveTriggerPositionalAmplitudes,System.Single)",
|
"System.Void ObjCRuntime.Messaging::void_objc_msgSendSuper_GCDualSenseAdaptiveTriggerPositionalAmplitudes_float(System.IntPtr,System.IntPtr,GameController.GCDualSenseAdaptiveTriggerPositionalAmplitudes,System.Single)",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче