| Summary: | g4py compilation fails in 9.3.p02 due to change in G4RunManager function signatures | ||
|---|---|---|---|
| Product: | Environments | Reporter: | gahs |
| Component: | g4py | Assignee: | Koichi Murakami <Koichi.Murakami> |
| Status: | CLOSED FIXED | ||
| Severity: | normal | ||
| Priority: | P5 | ||
| Version: | 9.3 | ||
| Hardware: | All | ||
| OS: | All | ||
Thanks for your report. It will be fixed in the 9.4 release. |
I found I could not compile g4py for Geant4 release 9.3.p02. (Which is a shame, because I really like g4py!) This is a regression with respect to Geant4 9.3, in which g4py compiled fine. The cause turns out to be a change made to G4RunManager between 9.3 and 9.3.p02 in the way G4Strings are passed and returned to several member functions. Specifically, the functions changed in G4RunManager are DumpRegion, GetVersionString, and GetRandomNumberStoreDir. The compilation problem can be fixed by making three small changes in pyG4RunManager.cc to account for the new function definitions in G4RunManager. Below is as unified diff of the changes needed. Hope it helps, and thanks for g4py! --- pyG4RunManager.cc_orig 2006-06-29 10:35:12.000000000 -0500 +++ pyG4RunManager.cc 2010-11-18 13:32:44.000000000 -0600 @@ -72,8 +72,8 @@ = &G4RunManager::SetUserAction; // DumpRegion -void (G4RunManager::*f1_DumpRegion)(G4String) const - = &G4RunManager::DumpRegion; +void (G4RunManager::*f1_DumpRegion)(const G4String&) const + = &G4RunManager::DumpRegion; void (G4RunManager::*f2_DumpRegion)(G4Region*) const = &G4RunManager::DumpRegion; @@ -148,7 +148,8 @@ f_AbortRun((arg("soft_abort")=false), "Abort run (event loop).")) .def("AbortEvent", &G4RunManager::AbortEvent) - .def("GetVersionString", &G4RunManager::GetVersionString) + .def("GetVersionString", &G4RunManager::GetVersionString, + return_value_policy<return_by_value>()) .def("DefineWorldVolume", &G4RunManager::DefineWorldVolume, f_DefineWorldVolume()) .def("DumpRegion", f1_DumpRegion) @@ -160,7 +161,8 @@ .def("SetRandomNumberStore", &G4RunManager::SetRandomNumberStore) .def("GetRandomNumberStore", &G4RunManager::GetRandomNumberStore) .def("SetRandomNumberStoreDir", &G4RunManager::SetRandomNumberStoreDir) - .def("GetRandomNumberStoreDir", &G4RunManager::GetRandomNumberStoreDir) + .def("GetRandomNumberStoreDir", &G4RunManager::GetRandomNumberStoreDir, + return_value_policy<return_by_value>()) .def("GeometryHasBeenModified", &G4RunManager::GeometryHasBeenModified) .def("PhysicsHasBeenModified", &G4RunManager::PhysicsHasBeenModified) .def("GetGeometryToBeOptimized",&G4RunManager::GetGeometryToBeOptimized)