Index: trunk/SophyaLib/SysTools/cxxcmplnk.cc
===================================================================
--- trunk/SophyaLib/SysTools/cxxcmplnk.cc	(revision 1837)
+++ trunk/SophyaLib/SysTools/cxxcmplnk.cc	(revision 1900)
@@ -36,5 +36,5 @@
 
 /* --Methode-- */
-CxxCompilerLinker::CxxCompilerLinker()
+CxxCompilerLinker::CxxCompilerLinker(bool fglibsophya, bool fglibextsophya, bool fglibpi)
   : verbose(false)
 {
@@ -92,4 +92,11 @@
 #endif
 
+#ifndef Darwin
+  linkCmd = compCmd;
+#else
+  linkCmd = "cc -bundle -flat_namespace -undefined suppress ";
+  linkOptions = "-L/usr/lib/gcc/darwin/default -lstdc++ -lcc_dynamic -lpthread -lm";
+#endif
+
   cppFlags += " -I. ";
   compOptions += " -c ";
@@ -102,5 +109,8 @@
     if (dpcbase[dpcbase.length()-1] != '/')  dpcbase += '/';
     cppFlags += ( " -I" + dpcbase + "Include/ ");
-    linkOptions += " -L" + dpcbase + syscomp + "ShLibs/ -lextsophya -lsophya -lm "; 
+    linkOptions += " -L" + dpcbase + syscomp + "ShLibs/";
+    if (fglibsophya) linkOptions += " -lsophya ";
+    if (fglibextsophya) linkOptions += " -lextsophya ";
+    if (fglibpi) linkOptions += " -lPI ";
   }
 
@@ -151,4 +161,7 @@
 int CxxCompilerLinker::BuildSO(string const & oname, string & soname)
 {
+  //  char * soext = ".dylib"; if defined(Darwin) - pas necessaire Reza 02/2002
+  char * soext = ".so";
+
   if (soname.length() < 1) {
     size_t l,p,q;
@@ -158,9 +171,9 @@
     else p++;
     q = oname.find('.');
-    if (q < l)  soname = tmpDir + oname.substr(p, q-p) + ".so";
-    else soname = tmpDir + oname.substr(p) + ".so";
+    if (q < l)  soname = tmpDir + oname.substr(p, q-p) + soext;
+    else soname = tmpDir + oname.substr(p) + soext;
   }
   string cmd;
-  cmd = compCmd + linkOptions + "-o " + soname + " " + oname ; 
+  cmd = linkCmd + " " + oname + " " + linkOptions + " -o " + soname + " " ; 
   if (verbose)
     cout << "CxxCompilerLinker::BuildSO() - Executing \n" << cmd << endl; 
Index: trunk/SophyaLib/SysTools/cxxcmplnk.h
===================================================================
--- trunk/SophyaLib/SysTools/cxxcmplnk.h	(revision 1837)
+++ trunk/SophyaLib/SysTools/cxxcmplnk.h	(revision 1900)
@@ -16,5 +16,6 @@
 class CxxCompilerLinker {
 public:
-			CxxCompilerLinker();  
+  CxxCompilerLinker(bool fglibsophya=true, bool fglibextsophya=true, 
+					  bool fglibpi=false);  
   virtual		~CxxCompilerLinker();
 
@@ -47,4 +48,5 @@
   string  tmpDir;
   string  compCmd;
+  string  linkCmd;
   string  compOptions;
   string  linkOptions;
Index: trunk/SophyaLib/SysTools/pdlmgr.cc
===================================================================
--- trunk/SophyaLib/SysTools/pdlmgr.cc	(revision 1837)
+++ trunk/SophyaLib/SysTools/pdlmgr.cc	(revision 1900)
@@ -15,5 +15,5 @@
 static const char* sofext = ".so";
 static const char* sofext_HPUX = ".sl";
-static const char* sofext_Darwin = ".bundle";
+// static const char* sofext_Darwin = ".dylib"; pas necessaire - Reza 02/2002
 
 // Variables et methodes static
@@ -172,5 +172,5 @@
   cmd = "ld -b -o " + fnameso + " " + fnameobj + " -lm -lc";
 #elif defined(Darwin)
-  cmd = "ld -bundle -o " + fnameso + " " + fnameobj + " -lm  -lcc_dynamic -lSystem -lbundle1.o";
+  cmd = "cc -bundle -flat_namespace -o " + fnameso + " " + fnameobj + " -lm  -lcc_dynamic -lSystem -lbundle1.o";
 #else 
   cmd = "ld -o " + fnameso + " " + fnameobj + " -lm -lc";
@@ -203,6 +203,4 @@
 #ifdef HPUX
   soname += sofext_HPUX;
-#elif defined(Darwin)
- soname += sofext_Darwin;
 #else
   soname += sofext;
@@ -230,4 +228,5 @@
 else fnameso = soname;
 copy = cp;
+ fnameso = soname;
 soName = fnameso;
 
@@ -236,13 +235,4 @@
 cerr << "PDynLinkMgr::PDynLinkMgr() Not yet available on HP-UX " << endl;
 return;
-#elif defined(Darwin)
- int rc = NSCreateObjectFileImageFromFile(fnameso.c_str(), &shfim);
- if (rc != NSObjectFileImageSuccess) {
-   cerr << "PDynLinkMgr::PDynLinkMgr(): Error opening SO " << fnameso
-	<< " (" << soname << ")" << endl;
-   cerr << "Loader Error (dlerror()) :" << rc << endl;
-   return;
- }
- shmod = NSLinkModule(shfim, fnameso.c_str(), 0);
 #else
 dlhandle =  dlopen(fnameso.c_str(), RTLD_NOW);
@@ -265,7 +255,4 @@
 cerr << "PDynLinkMgr::~PDynLinkMgr() Not yet available on HP-UX " << endl;
 return;
-#elif defined(Darwin)
- NSUnLinkModule(shmod, 0);
- NSDestroyObjectFileImage(shfim);
 #else
 if (dlhandle) dlclose(dlhandle);    dlhandle = NULL;
@@ -286,11 +273,12 @@
 cerr << "PDynLinkMgr::GetFunction() Not yet available on HP-UX " << endl;
 return f;
-#elif defined(Darwin)
- void* sym = NSLookupSymbolInModule(shmod,funcname.c_str());
- f = (DlFunction) NSAddressOfSymbol(sym);
- return f;
-#else
+#else 
+#if defined(Darwin)
+string funame = "_" + funcname;
+#else 
+string & funame = funcname;
+#endif
 if (dlhandle != NULL)  
-  f = (DlFunction)dlsym(dlhandle, funcname.c_str());
+  f = (DlFunction)dlsym(dlhandle, funame.c_str());
 if (f == NULL) cerr << "PDynLinkMgr::GetFunction(): Error linking " << funcname << endl;
 return(f);
Index: trunk/SophyaLib/SysTools/pdlmgr.h
===================================================================
--- trunk/SophyaLib/SysTools/pdlmgr.h	(revision 1837)
+++ trunk/SophyaLib/SysTools/pdlmgr.h	(revision 1900)
@@ -13,5 +13,5 @@
 #include <dl.h>
 #elif defined(Darwin)
-#include <mach-o/dyld.h>
+#include </sw/include/dlfcn.h>
 #else
 #include <dlfcn.h>
@@ -43,7 +43,4 @@
 #if defined(HPUX)
   shl_t dlhandle;
-#elif defined(Darwin)
-  NSObjectFileImage shfim;
-  NSModule          shmod;
 #else 
   void * dlhandle;
