示例#1
0
 private void CollectSymbols(string outputDir, string library)
 {
     using (var parserOptions = new ParserOptions())
     {
         parserOptions.AddLibraryDirs(outputDir);
         var output = GetOutputFile(library);
         parserOptions.LibraryFile = output;
         using (var parserResult = Parser.ClangParser.ParseLibrary(parserOptions))
         {
             if (parserResult.Kind == ParserResultKind.Success)
             {
                 var nativeLibrary = ClangParser.ConvertLibrary(parserResult.Library);
                 lock (@lock)
                 {
                     Context.Symbols.Libraries.Add(nativeLibrary);
                     Context.Symbols.IndexSymbols();
                 }
             }
             else
             {
                 Diagnostics.Error($"Parsing of {Path.Combine(outputDir, output)} failed.");
             }
         }
     }
 }
示例#2
0
 private void CollectSymbols(string outputDir, string symbols, string errorMessage)
 {
     using (var parserOptions = new ParserOptions())
     {
         parserOptions.AddLibraryDirs(outputDir);
         var output = Path.GetFileName($@"{(Platform.IsWindows ?
             string.Empty : "lib")}{symbols}.{
             (Platform.IsMacOS ? "dylib" : Platform.IsWindows ? "dll" : "so")}");
         if (!File.Exists(Path.Combine(outputDir, output)))
         {
             Diagnostics.Error(errorMessage);
             return;
         }
         parserOptions.LibraryFile = output;
         using (var parserResult = Parser.ClangParser.ParseLibrary(parserOptions))
         {
             if (parserResult.Kind == ParserResultKind.Success)
             {
                 var nativeLibrary = ClangParser.ConvertLibrary(parserResult.Library);
                 lock (@lock)
                 {
                     Context.Symbols.Libraries.Add(nativeLibrary);
                     Context.Symbols.IndexSymbols();
                 }
             }
             else
             {
                 Diagnostics.Error($"Parsing of {Path.Combine(outputDir, output)} failed.");
             }
         }
     }
 }