internal static SwiftMetatype?FromDylib(DynamicLib dylib, string metaDescName, int offset)
        {
            var meta = dylib.FindSymbolAddress(metaDescName);

            if (meta == IntPtr.Zero)
            {
                return(null);
            }

            return(new SwiftMetatype(meta + offset));
        }
Exemplo n.º 2
0
 public static IntPtr ProtocolWitnessTableFromFile(string dylibFile, string conformanceIdentifier, SwiftMetatype metadata)
 {
     using (var dylib = new DynamicLib(dylibFile, DLOpenMode.Now)) {
         var descriptor = dylib.FindSymbolAddress(conformanceIdentifier);
         if (descriptor == IntPtr.Zero)
         {
             throw new SwiftRuntimeException($"Unable to find swift protocol conformance descriptor {conformanceIdentifier} in file {dylib}");
         }
         return(swift_getWitnessTable(descriptor, metadata, IntPtr.Zero));
     }
 }