Index: /trunk/SophyaPI/PIext/dlftypes.h
===================================================================
--- /trunk/SophyaPI/PIext/dlftypes.h	(revision 170)
+++ /trunk/SophyaPI/PIext/dlftypes.h	(revision 171)
@@ -14,5 +14,4 @@
 #endif
 
-typedef void (* DlFunction) (void);
 typedef double (* DlFunctionOfX) (double x);
 typedef double (* DlFunctionOfXY) (double x, double y);
Index: /trunk/SophyaPI/PIext/piacmd.cc
===================================================================
--- /trunk/SophyaPI/PIext/piacmd.cc	(revision 170)
+++ /trunk/SophyaPI/PIext/piacmd.cc	(revision 171)
@@ -2,6 +2,4 @@
 #include <stdlib.h>
 #include <math.h>
-
-#include <dlfcn.h>
 
 #include <iostream.h>
@@ -42,15 +40,9 @@
 else { mObjMgr = new NamedObjMgr;  mOmg = true; }
 mImgApp = app;
-char* varenv;
-TmpDir = "";
-if ( (varenv=getenv("PEIDA_TMP")) != NULL )  TmpDir = varenv; 
-else if ( (varenv=getenv("TMPDIR")) != NULL )  TmpDir = varenv; 
-int l = TmpDir.length();
-if ( (l>0) && (TmpDir[l-1] != '/') )  TmpDir += '/';
 system("cp history.pic hisold.pic");
 hist.open("history.pic");
 trace = false;   timing = false;
 gltimer = NULL;
-dlhandle = NULL;
+dynlink = NULL;
 }
 
@@ -605,17 +597,13 @@
                           string& func4, string& func5)
 {
-string fnamesol = TmpDir + "spiup.so"; 
 string cmd;
 int rc;
 
-if (dlhandle) dlclose(dlhandle);    dlhandle = NULL;
+if (dynlink) delete dynlink;    dynlink = NULL;
 usfmap.clear();
-cmd = "cp " + fnameso + " " + fnamesol;
-rc = system(cmd.c_str());
-if (rc != 0)  { cerr << "PIACmd::LinkUserFuncs() Error system(" << cmd << ") Rc= " << rc << endl; return(1); }
-
-dlhandle =  dlopen(fnamesol.c_str(), RTLD_NOW);
-if (dlhandle == NULL) { 
-  string sn = fnamesol; 
+
+dynlink = new PDynLinkMgr(fnameso, true);
+if (dynlink == NULL) { 
+  string sn = fnameso; 
   cerr << "PIACmd/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl; 
   sn = dlerror();
@@ -630,5 +618,5 @@
 if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") )  goto fin;
 // f = (DlUserProcFunction)  dlsym(dlhandle, func1.c_str());
-f = (DlFunction)  dlsym(dlhandle, func1.c_str());
+f = dynlink->GetFunction(func1);
 if (f) { nok++;  usfmap[func1] = f; }
 else cerr << "PIACmd/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
@@ -636,5 +624,5 @@
 if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") )  goto fin;
 // f = (DlUserProcFunction)  dlsym(dlhandle, func2.c_str());
-f = (DlFunction)  dlsym(dlhandle, func2.c_str());
+f = dynlink->GetFunction(func2);
 if (f) { nok++;  usfmap[func2] = f; }
 else cerr << "PIACmd/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
@@ -642,5 +630,5 @@
 if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") )  goto fin;
 // f = (DlUserProcFunction)  dlsym(dlhandle, func3.c_str());
-f = (DlFunction)  dlsym(dlhandle, func3.c_str());
+f = dynlink->GetFunction(func3);
 if (f) { nok++;  usfmap[func3] = f; }
 else cerr << "PIACmd/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
@@ -648,5 +636,5 @@
 if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") )  goto fin;
 // f = (DlUserProcFunction)  dlsym(dlhandle, func4.c_str());
-f = (DlFunction)  dlsym(dlhandle, func4.c_str());
+f = dynlink->GetFunction(func4);
 if (f) { nok++;  usfmap[func4] = f; }
 else cerr << "PIACmd/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
@@ -654,10 +642,10 @@
 if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") )  goto fin;
 // f = (DlUserProcFunction)  dlsym(dlhandle, func5.c_str());
-f = (DlFunction)  dlsym(dlhandle, func5.c_str());
+f = dynlink->GetFunction(func5);
 if (f) { nok++;  usfmap[func5] = f; }
 else cerr << "PIACmd/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
 
 fin:
-if (nok < 1) { dlclose(dlhandle);    dlhandle = NULL; return(3); }
+if (nok < 1) { if (dynlink) delete dynlink;    dynlink = NULL;  return(3); }
 else return(0);
 }
Index: /trunk/SophyaPI/PIext/piacmd.h
===================================================================
--- /trunk/SophyaPI/PIext/piacmd.h	(revision 170)
+++ /trunk/SophyaPI/PIext/piacmd.h	(revision 171)
@@ -16,4 +16,6 @@
 #include <map.h>
 #endif
+
+#include "pdlmgr.h"
 
 #include "ctimer.h"
@@ -50,8 +52,6 @@
 // typedef map<string, DlUserProcFunction, less<string> > UsFmap;
 typedef map<string, DlFunction, less<string> > UsFmap;
-  void *dlhandle;      // Pour le link dynamique 
+  PDynLinkMgr* dynlink;
   UsFmap usfmap;
-  string TmpDir;       // Repertoire pour les compilations / link dynamique
-
 
 };
Index: /trunk/SophyaPI/PIext/pigfd2.cc
===================================================================
--- /trunk/SophyaPI/PIext/pigfd2.cc	(revision 170)
+++ /trunk/SophyaPI/PIext/pigfd2.cc	(revision 171)
@@ -53,4 +53,12 @@
 Set3DView((xmin+xmax)/2., (ymin+ymax)/2, (zmin+zmax)/2., 
           (xmin+xmax)/2.+D , (ymin+ymax)/2.+2.*D , zmin+(zmax-zmin)*0.2, 0.3, 0.3);  
+
+xMin = xmin - 0.05*(xmax-xmin);
+xMax = xmax + 0.05*(xmax-xmin);
+yMin = ymin - 0.05*(ymax-ymin);
+yMax = ymax + 0.05*(ymax-ymin);
+zMin = zmin - 0.05*(zmax-zmin);
+zMax = zmax + 0.05*(zmax-zmin);
+
 }
 
Index: /trunk/SophyaPI/PIext/pintup3d.cc
===================================================================
--- /trunk/SophyaPI/PIext/pintup3d.cc	(revision 170)
+++ /trunk/SophyaPI/PIext/pintup3d.cc	(revision 171)
@@ -68,4 +68,12 @@
   Set3DView((xmin+xmax)/2., (ymin+ymax)/2, (zmin+zmax)/2., 
             (xmin+xmax)/2.+D , (ymin+ymax)/2.+2.*D , zmin+(zmax-zmin)*0.2, 0.3, 0.3);  
+
+  xMin = xmin - 0.05*(xmax-xmin);
+  xMax = xmax + 0.05*(xmax-xmin);
+  yMin = ymin - 0.05*(ymax-ymin);
+  yMax = ymax + 0.05*(ymax-ymin);
+  zMin = zmin - 0.05*(zmax-zmin);
+  zMax = zmax + 0.05*(zmax-zmin);
+
 //  printf("PINTuple3D::UpdateLimits() : %g-%g  %g-%g  %g-%g (%g) \n", xmin,xmax,ymin,ymax,zmin,zmax,D);
 //  printf("PINTuple3D::UpdateLimits() :  %g %g %g << %g %g %g \n", 
Index: /trunk/SophyaPI/PIext/servnobjm.cc
===================================================================
--- /trunk/SophyaPI/PIext/servnobjm.cc	(revision 170)
+++ /trunk/SophyaPI/PIext/servnobjm.cc	(revision 171)
@@ -2,6 +2,4 @@
 #include <stdlib.h>
 #include <ctype.h>
-
-#include <dlfcn.h>
 
 #include <iostream.h>
@@ -44,6 +42,7 @@
 {
 TmpDir = tmpdir;
+PDynLinkMgr::SetTmpDir(tmpdir);
 mImgapp = app;
-dlhandle = NULL;
+dynlink = NULL;
 InitGrAttNames();
 }
@@ -339,39 +338,14 @@
 string fnameobj = fnamer + ".o" ;
 string fnameso = fnamer + ".so";
-string cmd;
-int rc;
-
-
-// Compilation du fichier
-cmd = "cc -c -o " + fnameobj + " " + fname;
-rc = system(cmd.c_str());
-
-if (rc != 0)  { 
-  printf("LinkFunctionFromFile_Do> %s  (Rc=%d)\n", cmd.c_str(), rc); 
-  return(NULL);
-  }
-#if defined(OSF1) 
-  cmd = "ld -shared -o " + fnameso + " -all " + fnameobj + " -none -lm -lc";
-#else
-  cmd = "ld -shared -o " + fnameso + " " + fnameobj + " -lm -lc";
-#endif
-rc = system(cmd.c_str());
-if (rc != 0 ) { 
-  printf("LinkFunctionFromFile_Do> %s  (Rc=%d)\n", cmd.c_str(), rc); 
-  return(NULL);
-  }
 
 //  Le link dynamique
 CloseDLL();
-dlhandle =  dlopen(fnameso.c_str(), RTLD_NOW);
-if (dlhandle == NULL) { 
-  string sn = fnameso; 
-  cerr << "NamedObjMgr/FunctionFromFile_Erreur: Erreur ouverture SO " << sn << endl; 
-  sn = dlerror();
-  cerr << "Loader Error (dlerror()) :" << sn;
+dynlink = PDynLinkMgr::BuildFromCFile(fname);
+if (dynlink == NULL) { 
+  cerr << "NamedObjMgr/LinkFunctionFromFile_Erreur: Erreur ouverture SO " << endl; 
   return(NULL); 
   }
 
-DlFunction retfunc = (DlFunction) dlsym(dlhandle, funcname);
+DlFunction retfunc = dynlink->GetFunction(funcname);
 if (retfunc == NULL) { 
   string sn = funcname; 
@@ -386,5 +360,5 @@
 void Services2NObjMgr::CloseDLL()
 {
-if (dlhandle) dlclose(dlhandle);    dlhandle = NULL;
+if (dynlink) delete dynlink;   dynlink = NULL;
 }
 
Index: /trunk/SophyaPI/PIext/servnobjm.h
===================================================================
--- /trunk/SophyaPI/PIext/servnobjm.h	(revision 170)
+++ /trunk/SophyaPI/PIext/servnobjm.h	(revision 171)
@@ -12,4 +12,5 @@
 #include "ctimer.h"
 
+#include "pdlmgr.h"
 #include "dlftypes.h"
 
@@ -57,6 +58,6 @@
   GrAttNames GrAzoom;  
 
-  void* dlhandle;  // shared-lib lib.so
-  string TmpDir;   // Pour le link dynamique
+  PDynLinkMgr * dynlink;  // shared-lib lib.so
+  string TmpDir;          // Pour fichiers temporaires
 
   PIStdImgApp* mImgapp;
