Re: oMan oBrag

From: Christian Holm Christensen (cholm@hehi03.nbi.dk)
Date: Thu Jan 30 2003 - 11:04:50 EST

  • Next message: Flemming Videbaek: "Brat version 2.7.2"
    Hi Flemming et al, 
    
    "Flemming Videbaek" <videbaek@sgs1.hirg.bnl.gov> wrote concerning
      oMan oBrag [Thu, 30 Jan 2003 10:22:06 -0500] 
    ----------------------------------------------------------------------
      ^^^^^^^^^^
      What's the `o' for? 
    
    > -- I believe he uses the HepOsX geantlibraries as is, not compiling;
    > Already at this stage there are two independent .cdf files namely
    > one from PAW and one from GEANT - We also traced the 'multiple defs' 
    
    Ah, OK, so it's a linker issue.  `Normally' - that is, on most Unix'es
    and on GNU/Linux  - what happens is this:  If the linker sees a symbol
    in a archive (a.k.a. static library) or and object file, then it marks
    that symbol as defined and it ignores any subsequent occurrence of
    that symbol.  So, say you have the function `foo' in the archive
    `libfoo.a', but also compile another object that contains the symbol
    `foo' the latter will override the first.  This feature was exploited
    in old libraries and analysis frameworks for customisation.  Nowadays,
    it's more appropriate to use dynamic loading to do that: 
    
      // Initialise the libtool ltdl library
      lt_dlinit();
    
      // Open users library 
      // one of: (myconf.la|(myconf.so|myconf.sl|myconf.dll|...))
      lt_dlhandle h = lt_dlopenext("myconf"); 
      if (!h) throw std:runtime_error(lt_dlerror());
    
      // Get the initialiaser roiutine and execute it 
      lt_ptr s = lt_dlsym(h, "init_framework");
      if (!s) throw std:runtime_error(lt_dlerror());
      ((framework_init_function)(*s))();
    
    [This is what happens behind your back when you do TSystem::Load
    btw. There the `init' function registers interfaces to the classes,
    ladida in the library]
    
    Now, on MacOSX (which _isn't_ Unix - it's a micro-kernel with a
    one-server BSD layer on top, providing the POSIX interface), the
    linker may not behave like that.  Perhaps you need to set a flag.  You
    can pass flags to the linker from libtool via the options -Xlinker or
    -Wl, (check the manual). 
    
    > to statements that kuipc generates so this must have been by-passed
    > somehow in the gen of the geant, pawlibs. 
    
    Perhaps there's a linker flag? 
    
    Yours, 
    
     ___  |  Christian Holm Christensen 
      |_| |	 -------------------------------------------------------------
        | |	 Address: Sankt Hansgade 23, 1. th.  Phone:  (+45) 35 35 96 91
         _|	          DK-2200 Copenhagen N       Cell:   (+45) 24 61 85 91
        _|	          Denmark                    Office: (+45) 353  25 305
     ____|	 Email:   cholm@nbi.dk               Web:    www.nbi.dk/~cholm
     | |
    


    This archive was generated by hypermail 2.1.5 : Thu Jan 30 2003 - 11:06:01 EST