|Message: Need help with static linkage to developed libreries||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
First, I apologizes if this is the wrong forum section for my question, but it seemed to me that, of all the forum sections, this one was the most appropriate.
I am developing a GEANT4 program to simulate a PET system (not based in crystal detectors, so I can not use GATE).
As the size of the program grew up, I decided to separate some classes, which encapsulate similar functionalities, into independent and self-contained libraries. Among them are the Physics ans Phantom classes. Both use several messengers to set parameters at run time.
Physics classes runs ok with static linkage to the program, but Phantom classes does not, and originate a memory corruption in the program. However, Phantom classes run without problems, and as expected, if used as part of the code, rather than in a static library.
Phantom class is composed of a singleton PhantomFactory (with an associated messenger), that manages the creation and storage of individual phantoms, all derived from a base abstract class (VPhantom). Each individual Phantom has a messengers to set its own parameters. The problem is precisely in these messengers, namely in the creation of the messenger command tree. During the creation of the command strings a memory corruption occurs:
G4String sPhtName = m_pPhantom->GetPhantomName(); G4String sBaseDir = "/Phantoms/" + sPhtName;
m_pPhtDir = new G4UIdirectory(G4String(sBaseDir + "/"));
I think the error occurs in the creation of the G4UIdirectory, during the assignment of the string parameter passed as argument, to a G4String in the constructor of G4UIcommand. This error is traceable to libc, during the assignment.
Can anyone give me a hint on how to solve this problem, in order for me to use the Phantom classes in a separate library?
By the way, the system I am running the code in is Kubuntu 10.04 64 bit, upgraded to Kubuntu 10.10, with gcc version 4.4.3 (4ubuntu5), and GEANT4 v9.2-p04
Thanks in advance, Miguel Couceiro
PS1: I have also attached all the files to this message, just in case someone wants to test them.
PS2: To use the class, the singleton PhantomFactory object has to be created first, for instance, at the beginning of main(). Other phantoms will be added, but for now only 3 are implemented.