Exemple #1
0
        static NativeLibraryBuilder()
        {
            AssemblyBuilder = AssemblyBuilder.DefineDynamicAssembly
                              (
                new AssemblyName(DynamicAssemblyName), AssemblyBuilderAccess.Run
                              );

            #if DEBUG
            var dbgType        = typeof(DebuggableAttribute);
            var dbgConstructor = dbgType.GetConstructor(new[] { typeof(DebuggableAttribute.DebuggingModes) });
            var dbgModes       = new object[]
            {
                DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.Default
            };

            var dbgBuilder = new CustomAttributeBuilder(dbgConstructor, dbgModes);

            AssemblyBuilder.SetCustomAttribute(dbgBuilder);
            #endif

            ModuleBuilder = AssemblyBuilder.DefineDynamicModule(DynamicModuleName);

            TypeCache = new ConcurrentDictionary <GeneratedImplementationTypeIdentifier, Type>
                        (
                new LibraryIdentifierEqualityComparer()
                        );

            TransformerRepository = new TypeTransformerRepository();

            Default = new NativeLibraryBuilder
                      (
                GenerateDisposalChecks | EnableDllMapSupport
                      );
        }
        static NativeLibraryBuilder()
        {
            TypeCache = new ConcurrentDictionary <GeneratedImplementationTypeIdentifier, Type>
                        (
                new LibraryIdentifierEqualityComparer()
                        );

            Default = new NativeLibraryBuilder
                      (
                GenerateDisposalChecks | EnableDllMapSupport | EnableOptimizations | SuppressSecurity
                      );
        }