@@ -389,7 +389,7 @@ CPPINTEROP_API std::string GetQualifiedCompleteName(TCppScope_t klass);
389
389
CPPINTEROP_API std::vector<TCppScope_t> GetUsingNamespaces (TCppScope_t scope);
390
390
391
391
// / Gets the global scope of the whole C++ instance.
392
- CPPINTEROP_API TCppScope_t GetGlobalScope ();
392
+ CPPINTEROP_API TCppScope_t GetGlobalScope (TInterp_t interp = nullptr );
393
393
394
394
// / Strips the typedef and returns the underlying class, and if the
395
395
// / underlying decl is not a class it returns the input unchanged.
@@ -398,18 +398,28 @@ CPPINTEROP_API TCppScope_t GetUnderlyingScope(TCppScope_t scope);
398
398
// / Gets the namespace or class (by stripping typedefs) for the name
399
399
// / passed as a parameter, and if the parent is not passed,
400
400
// / then global scope will be assumed.
401
+ // / Looks up the name in parent, if parent is nullptr,
402
+ // / interp is used to select the interpreter if multiple in-use.
403
+ // / interp is ignored if parent is non-null.
401
404
CPPINTEROP_API TCppScope_t GetScope (const std::string& name,
402
- TCppScope_t parent = nullptr );
405
+ TCppScope_t parent = nullptr ,
406
+ TInterp_t interp = nullptr );
403
407
404
408
// / When the namespace is known, then the parent doesn't need
405
409
// / to be specified. This will probably be phased-out in
406
410
// / future versions of the interop library.
407
- CPPINTEROP_API TCppScope_t GetScopeFromCompleteName (const std::string& name);
411
+ // / interp is used to select the interpreter if multiple in-use.
412
+ CPPINTEROP_API TCppScope_t GetScopeFromCompleteName (const std::string& name,
413
+ TInterp_t interp = nullptr );
408
414
409
415
// / This function performs a lookup within the specified parent,
410
416
// / a specific named entity (functions, enums, etcetera).
417
+ // / Looks up the name in parent, if parent is nullptr,
418
+ // / interp is used to select the interpreter if multiple in-use.
419
+ // / interp is ignored if parent is non-null.
411
420
CPPINTEROP_API TCppScope_t GetNamed (const std::string& name,
412
- TCppScope_t parent = nullptr );
421
+ TCppScope_t parent = nullptr ,
422
+ TInterp_t interp = nullptr );
413
423
414
424
// / Gets the parent of the scope that is passed as a parameter.
415
425
CPPINTEROP_API TCppScope_t GetParentScope (TCppScope_t scope);
@@ -493,8 +503,12 @@ CPPINTEROP_API bool IsTemplatedFunction(TCppFunction_t func);
493
503
494
504
// / This function performs a lookup to check if there is a
495
505
// / templated function of that type.
506
+ // / Looks up the name in parent, if parent is nullptr,
507
+ // / interp is used to select the interpreter if multiple in-use.
508
+ // / interp is ignored if parent is non-null.
496
509
CPPINTEROP_API bool ExistsFunctionTemplate (const std::string& name,
497
- TCppScope_t parent = nullptr );
510
+ TCppScope_t parent = nullptr ,
511
+ TInterp_t interp = nullptr );
498
512
499
513
// / Sets a list of all the constructor for a scope/class that is
500
514
// / supplied as a parameter.
@@ -542,7 +556,8 @@ CPPINTEROP_API bool IsDestructor(TCppConstFunction_t method);
542
556
CPPINTEROP_API bool IsStaticMethod (TCppConstFunction_t method);
543
557
544
558
// /\returns the address of the function given its potentially mangled name.
545
- CPPINTEROP_API TCppFuncAddr_t GetFunctionAddress (const char * mangled_name);
559
+ CPPINTEROP_API TCppFuncAddr_t GetFunctionAddress (const char * mangled_name,
560
+ TInterp_t interp = nullptr );
546
561
547
562
// /\returns the address of the function given its function declaration.
548
563
CPPINTEROP_API TCppFuncAddr_t GetFunctionAddress (TCppFunction_t method);
@@ -643,7 +658,9 @@ CPPINTEROP_API TCppType_t GetCanonicalType(TCppType_t type);
643
658
644
659
// / Used to either get the built-in type of the provided string, or
645
660
// / use the name to lookup the actual type.
646
- CPPINTEROP_API TCppType_t GetType (const std::string& type);
661
+ // / interp is used to select the interpreter if multiple in-use.
662
+ CPPINTEROP_API TCppType_t GetType (const std::string& type,
663
+ TInterp_t interp = nullptr );
647
664
648
665
// /\returns the complex of the provided type.
649
666
CPPINTEROP_API TCppType_t GetComplexType (TCppType_t element_type);
@@ -727,10 +744,10 @@ CPPINTEROP_API void UseExternalInterpreter(TInterp_t I);
727
744
728
745
// / Adds a Search Path for the Interpreter to get the libraries.
729
746
CPPINTEROP_API void AddSearchPath (const char * dir, bool isUser = true ,
730
- bool prepend = false );
747
+ bool prepend = false , TInterp_t I = nullptr );
731
748
732
749
// / Returns the resource-dir path (for headers).
733
- CPPINTEROP_API const char * GetResourceDir ();
750
+ CPPINTEROP_API const char * GetResourceDir (TInterp_t I = nullptr );
734
751
735
752
// / Uses the underlying clang compiler to detect the resource directory.
736
753
// / In essence calling clang -print-resource-dir and checks if it ends with
@@ -751,46 +768,52 @@ DetectSystemCompilerIncludePaths(std::vector<std::string>& Paths,
751
768
752
769
// / Secondary search path for headers, if not found using the
753
770
// / GetResourceDir() function.
754
- CPPINTEROP_API void AddIncludePath (const char * dir);
771
+ CPPINTEROP_API void AddIncludePath (const char * dir, TInterp_t I = nullptr );
755
772
756
773
// Gets the currently used include paths
757
774
// /\param[out] IncludePaths - the list of include paths
758
775
// /
759
776
CPPINTEROP_API void GetIncludePaths (std::vector<std::string>& IncludePaths,
760
777
bool withSystem = false ,
761
- bool withFlags = false );
778
+ bool withFlags = false ,
779
+ TInterp_t I = nullptr );
762
780
763
781
// / Only Declares a code snippet in \c code and does not execute it.
764
782
// /\returns 0 on success
765
- CPPINTEROP_API int Declare (const char * code, bool silent = false );
783
+ CPPINTEROP_API int Declare (const char * code, bool silent = false ,
784
+ TInterp_t I = nullptr );
766
785
767
786
// / Declares and executes a code snippet in \c code.
768
787
// /\returns 0 on success
769
- CPPINTEROP_API int Process (const char * code);
788
+ CPPINTEROP_API int Process (const char * code, TInterp_t I = nullptr );
770
789
771
790
// / Declares, executes and returns the execution result as a intptr_t.
772
791
// /\returns the expression results as a intptr_t.
773
- CPPINTEROP_API intptr_t Evaluate (const char * code, bool * HadError = nullptr );
792
+ CPPINTEROP_API intptr_t Evaluate (const char * code, bool * HadError = nullptr ,
793
+ TInterp_t I = nullptr );
774
794
775
795
// / Looks up the library if access is enabled.
776
796
// /\returns the path to the library.
777
- CPPINTEROP_API std::string LookupLibrary (const char * lib_name);
797
+ CPPINTEROP_API std::string LookupLibrary (const char * lib_name,
798
+ TInterp_t I = nullptr );
778
799
779
800
// / Finds \c lib_stem considering the list of search paths and loads it by
780
801
// / calling dlopen.
781
802
// / \returns true on success.
782
- CPPINTEROP_API bool LoadLibrary (const char * lib_stem, bool lookup = true );
803
+ CPPINTEROP_API bool LoadLibrary (const char * lib_stem, bool lookup = true ,
804
+ TInterp_t I = nullptr );
783
805
784
806
// / Finds \c lib_stem considering the list of search paths and unloads it by
785
807
// / calling dlclose.
786
808
// / function.
787
- CPPINTEROP_API void UnloadLibrary (const char * lib_stem);
809
+ CPPINTEROP_API void UnloadLibrary (const char * lib_stem, TInterp_t I = nullptr );
788
810
789
811
// / Scans all libraries on the library search path for a given potentially
790
812
// / mangled symbol name.
791
813
// /\returns the path to the first library that contains the symbol definition.
792
- CPPINTEROP_API std::string
793
- SearchLibrariesForSymbol (const char * mangled_name, bool search_system /* true*/ );
814
+ CPPINTEROP_API std::string SearchLibrariesForSymbol (const char * mangled_name,
815
+ bool search_system /* true*/ ,
816
+ TInterp_t I = nullptr );
794
817
795
818
// / Inserts or replaces a symbol in the JIT with the one provided. This is
796
819
// / useful for providing our own implementations of facilities such as printf.
@@ -801,7 +824,8 @@ SearchLibrariesForSymbol(const char* mangled_name, bool search_system /*true*/);
801
824
// /
802
825
// /\returns true on failure.
803
826
CPPINTEROP_API bool InsertOrReplaceJitSymbol (const char * linker_mangled_name,
804
- uint64_t address);
827
+ uint64_t address,
828
+ TInterp_t I = nullptr );
805
829
806
830
// / Tries to load provided objects in a string format (prettyprint).
807
831
CPPINTEROP_API std::string ObjToString (const char * type, void * obj);
@@ -838,9 +862,10 @@ GetClassTemplateInstantiationArgs(TCppScope_t templ_instance,
838
862
839
863
// / Instantiates a function template from a given string representation. This
840
864
// / function also does overload resolution.
865
+ // /\param[in] interp - is used to select the interpreter if multiple in-use.
841
866
// /\returns the instantiated function template declaration.
842
- CPPINTEROP_API TCppFunction_t
843
- InstantiateTemplateFunctionFromString ( const char * function_template);
867
+ CPPINTEROP_API TCppFunction_t InstantiateTemplateFunctionFromString (
868
+ const char * function_template, TInterp_t interp = nullptr );
844
869
845
870
// / Finds best overload match based on explicit template parameters (if any)
846
871
// / and argument types.
0 commit comments