mirror of
https://gitee.com/csharpui/CPF.git
synced 2025-09-19 10:08:26 +08:00
初始化
This commit is contained in:
36
CPF.Mac/Mac/CoreFoundation/CFErrorDomain.cs
Normal file
36
CPF.Mac/Mac/CoreFoundation/CFErrorDomain.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using CPF.Mac.Foundation;
|
||||
using CPF.Mac.ObjCRuntime;
|
||||
using System;
|
||||
|
||||
namespace CPF.Mac.CoreFoundation
|
||||
{
|
||||
public static class CFErrorDomain
|
||||
{
|
||||
public static readonly NSString Cocoa;
|
||||
|
||||
public static readonly NSString Mach;
|
||||
|
||||
public static readonly NSString OSStatus;
|
||||
|
||||
public static readonly NSString Posix;
|
||||
|
||||
static CFErrorDomain()
|
||||
{
|
||||
IntPtr intPtr = Dlfcn.dlopen("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation", 0);
|
||||
if (!(intPtr == IntPtr.Zero))
|
||||
{
|
||||
try
|
||||
{
|
||||
Cocoa = Dlfcn.GetStringConstant(intPtr, "kCFErrorDomainCocoa");
|
||||
Mach = Dlfcn.GetStringConstant(intPtr, "kCFErrorDomainMach");
|
||||
OSStatus = Dlfcn.GetStringConstant(intPtr, "kCFErrorDomainOSStatus");
|
||||
Posix = Dlfcn.GetStringConstant(intPtr, "kCFErrorDomainPosix");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Dlfcn.dlclose(intPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user