public PipelineWorkUnit([NotNull] T definition, [NotNull] string symbolName, ImplementationOptions options)
 {
     Definition       = definition;
     BaseMemberName   = definition.Name;
     SymbolName       = symbolName;
     UniqueIdentifier = ((ulong)options).ToString();
 }
 private TInterface CreateAnonymousImplementationInstance <TInterface>
 (
     [NotNull] Type finalType,
     [NotNull] string library,
     ImplementationOptions options
 )
 {
     return((TInterface)CreateAnonymousImplementationInstance(finalType, library, options));
 }
示例#3
0
 protected NativeLibraryBase
 (
     [NotNull] string path,
     ImplementationOptions options
 )
 {
     Options        = options;
     _libraryHandle = PlatformLoader.LoadLibrary(path);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CallWrapperBase"/> class.
 /// </summary>
 /// <param name="targetModule">The module where the implementation should be generated.</param>
 /// <param name="targetType">The type in which the implementation should be generated.</param>
 /// <param name="targetTypeConstructorIL">The IL generator for the target type's constructor.</param>
 /// <param name="options">The configuration object to use.</param>
 protected CallWrapperBase
 (
     [NotNull] ModuleBuilder targetModule,
     [NotNull] TypeBuilder targetType,
     [NotNull] ILGenerator targetTypeConstructorIL,
     ImplementationOptions options
 )
     : base(targetModule, targetType, targetTypeConstructorIL, options)
 {
 }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GeneratedImplementationTypeIdentifier"/> struct.
 /// </summary>
 /// <param name="baseClassType">The base class of the library.</param>
 /// <param name="interfaceType">The interface type.</param>
 /// <param name="options">The configuration used for the library.</param>
 public GeneratedImplementationTypeIdentifier
 (
     [NotNull] Type baseClassType,
     [NotNull] IReadOnlyList <Type> interfaceType,
     ImplementationOptions options
 )
 {
     BaseClassType  = baseClassType;
     InterfaceTypes = interfaceType;
     Options        = options;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GeneratedImplementationTypeIdentifier"/> struct.
 /// </summary>
 /// <param name="baseClassType">The base class of the library.</param>
 /// <param name="interfaceType">The interface type.</param>
 /// <param name="libraryPath">The path to the library. Will be resolved to an absolute path.</param>
 /// <param name="options">The configuration used for the library.</param>
 public GeneratedImplementationTypeIdentifier
 (
     [NotNull] Type baseClassType,
     [NotNull] Type interfaceType,
     [NotNull] string libraryPath,
     ImplementationOptions options
 )
 {
     _baseClassType       = baseClassType;
     _interfaceType       = interfaceType;
     _options             = options;
     _absoluteLibraryPath = Path.GetFullPath(libraryPath);
 }
 protected NativeLibraryBase
 (
     [CanBeNull] string path,
     ImplementationOptions options,
     [CanBeNull] ILibraryLoader libLoader = null,
     [CanBeNull] ISymbolLoader symLoader  = null
 )
 {
     _libraryLoader = libLoader ?? PlatformLoaderBase.PlatformLoader;
     _symbolLoader  = symLoader ?? PlatformLoaderBase.PlatformLoader;
     Options        = options;
     _libraryHandle = _libraryLoader.LoadLibrary(path);
 }
 protected ImplementationGeneratorBase
 (
     [NotNull] ModuleBuilder targetModule,
     [NotNull] TypeBuilder targetType,
     [NotNull] ILGenerator targetTypeConstructorIL,
     ImplementationOptions options
 )
 {
     TargetModule            = targetModule;
     TargetType              = targetType;
     TargetTypeConstructorIL = targetTypeConstructorIL;
     Options = options;
 }
 private object CreateAnonymousImplementationInstance
 (
     [NotNull] Type finalType,
     [CanBeNull] string library,
     ImplementationOptions options
 )
 {
     return(Activator.CreateInstance
            (
                finalType,
                library,
                options
            ));
 }
        public NativeLibraryBuilder
        (
            ImplementationOptions options = default,
            [CanBeNull] ILibraryPathResolver pathResolver         = default,
            [CanBeNull] IDynamicAssemblyProvider assemblyProvider = default
        )
        {
            _assemblyProvider = assemblyProvider ?? new TransientDynamicAssemblyProvider(DynamicAssemblyName, !options.HasFlagFast(EnableOptimizations));

            _moduleBuilder = _assemblyProvider.GetDynamicModule();

            Options      = options;
            PathResolver = pathResolver ?? new DynamicLinkLibraryPathResolver();
        }
示例#11
0
 protected NativeLibraryBase
 (
     [NotNull] string path,
     [NotNull] Type interfaceType,
     ImplementationOptions options,
     [NotNull] TypeTransformerRepository transformerRepository
 )
 {
     Options = options;
     TransformerRepository = transformerRepository;
     _libraryHandle        = PlatformLoader.LoadLibrary(path);
     _path          = path;
     _interfaceType = interfaceType;
 }
 private object CreateAnonymousImplementationInstance
 (
     [NotNull] Type finalType,
     [CanBeNull] string library,
     ImplementationOptions options,
     ILibraryLoader libLoader = null,
     ISymbolLoader symLoader  = null
 )
 {
     return(Activator.CreateInstance
            (
                finalType,
                library,
                options,
                libLoader,
                symLoader
            ));
 }