Exemplo n.º 1
0
        /// <summary>
        /// Ctor of TccCompiler
        /// </summary>
        public TccCompiler()
        {
            FileInfo fi      = new FileInfo(Assembly.GetExecutingAssembly().Location);
            string   dirPath = fi.DirectoryName;


            if (dirPath == null)
            {
                dirPath = string.Empty;
            }

            var defaultLibPath        = Path.Combine(dirPath, "native\\lib");
            var defaultTccIncludePath = Path.Combine(dirPath, "native\\libtcc");
            var defaultIncludePath    = Path.Combine(dirPath, "native\\include");
            var defaultIncludeWindows = Path.Combine(dirPath, "native\\include\\winapi");

            this.Handle = CreateNew();
            if (this.Handle.Handle == IntPtr.Zero)
            {
                throw new Exception("Could not create TCC Instance!");
            }
            this._OpaqueRef = new HandleRef(this, Marshal.AllocHGlobal(512));
            if (this.IsX64)
            {
                TccErrorFuncDelegate64 dllErr = InternalCompilerErrorFunc;
                this.SetErrorFunction64(dllErr);
            }
            else
            {
                TccErrorFuncDelegate32 dllErr = InternalCompilerErrorFunc;
                this.SetErrorFunction32(dllErr);
            }

            this.AddIncludePath(defaultIncludePath);
            this.AddIncludePath(defaultTccIncludePath);
            this.AddIncludePath(defaultIncludeWindows);
            this.AddLibraryPath(defaultLibPath);
        }
Exemplo n.º 2
0
 public static extern void SetErrorFunc([In] HandleRef s, IntPtr errorOpaque, TccErrorFuncDelegate32 errorFunc);