Commits

wlav committed 2b8e6b3

fragile tests now work with CINT backend

Comments (0)

Files changed (4)

pypy/module/cppyy/capi/cint_capi.py

 
 from pypy.translator.tool.cbuild import ExternalCompilationInfo
 from pypy.rpython.lltypesystem import rffi
-from pypy.rlib import rdynload
+from pypy.rlib import libffi, rdynload
 
 __all__ = ['eci', 'c_load_dictionary']
 
     use_cpp_linker=True,
 )
 
-c_load_dictionary = rffi.llexternal(
+_c_load_dictionary = rffi.llexternal(
     "cppyy_load_dictionary",
     [rffi.CCHARP], rdynload.DLLHANDLE,
     compilation_info=eci)
+
+def c_load_dictionary(name):
+    result = _c_load_dictionary(name)
+    if not result:
+        err = rdynload.dlerror()
+        raise rdynload.DLOpenError(err)
+    return libffi.CDLL(name)       # should return handle to already open file

pypy/module/cppyy/src/cintcwrapper.cxx

 
 /*  CINT internals (won't work on Windwos) ------------------------------- */
 extern long G__store_struct_offset;
-extern "C" void* G__GetShlHandle();
+extern "C" void* G__SetShlHandle(char*);
+
 
 /* data for life time management ------------------------------------------ */
 typedef std::vector<TClassRef> ClassRefs_t;
     if (!cr.GetClass())
         return (cppyy_typehandle_t)NULL;
 
+    if (!cr->GetClassInfo())
+        return (cppyy_typehandle_t)NULL;
+
     if (!G__TypeInfo(class_name).IsValid())
         return (cppyy_typehandle_t)NULL;
 
 }
 
 void* cppyy_load_dictionary(const char* lib_name) {
-    if (gSystem->Load(lib_name))
-       return (void*)G__GetShlHandle();
-    return (void*)0;
+   if (0 <= gSystem->Load(lib_name))
+      return (void*)1;
+   return (void*)0;
 }

pypy/module/cppyy/test/Makefile

 #
 # rootcint -f advancedcpp_cint.cxx -c advancedcpp.h advancedcpp_LinkDef.h
 # g++ -I$ROOTSYS/include advancedcpp_cint.cxx advancedcpp.cxx -shared -o advancedcppDict.so -rdynamic
+#
+# rootcint -f fragile_cint.cxx -c fragile.h fragile_LinkDef.h
+# g++ -I$ROOTSYS/include fragile_cint.cxx fragile.cxx -shared -o fragileDict.so -rdynamic
+#
+# rootcint -f stltypes_cint.cxx -c stltypes.h stltypes_LinkDef.h
+# g++ -I$ROOTSYS/include stltypes_cint.cxx stltypes.cxx -shared -o stltypesDict.so -rdynamic
 
 # TODO: methptrgetter causes these tests to crash, so don't use it for now
 stltypesDict.so: stltypes.cxx stltypes.h stltypes.xml

pypy/module/cppyy/test/fragile_LinkDef.h

+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ namespace fragile;
+
+#pragma link C++ class fragile::A;
+#pragma link C++ class fragile::B;
+#pragma link C++ class fragile::C;
+#pragma link C++ class fragile::D;
+#pragma link C++ class fragile::E;
+#pragma link C++ class fragile::F;
+
+#endif
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.