[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnet/image link.c,1.28,1.29
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnet/image link.c,1.28,1.29 |
Date: |
Mon, 10 Nov 2003 05:14:46 +0000 |
Update of /cvsroot/dotgnu-pnet/pnet/image
In directory subversions:/tmp/cvs-serv4286/image
Modified Files:
link.c
Log Message:
Rearrange the assembly resolution order so that CSCC_LIB_PATH always comes
before libraries in the same directory as the parent, to avoid conflicts
with third-party CLI's, and without needing hacks like "pnetlib.here".
Index: link.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/link.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** link.c 7 Nov 2003 03:48:38 -0000 1.28
--- link.c 10 Nov 2003 05:14:44 -0000 1.29
***************
*** 35,75 ****
/*
! * The cached system path, loaded from the environment.
*/
static char **systemPath = 0;
static int systemPathSize = 0;
!
! /*
! * The explicit list of pnetlib assemblies which must override
! * any others with these names that we may encounter (e.g. Mono's).
! * We detect the pnetlib versions by looking for "pnetlib.here".
! */
! static const char * const systemAssemblies[] = {
! "mscorlib",
! "System",
! "System.Xml",
! };
! #define systemAssembliesSize \
! (sizeof(systemAssemblies) / sizeof(systemAssemblies[0]))
/*
* Add a pathname to "systemPaths".
*/
! static void AddSystemPath(const char *path, int len)
{
char **newPathList;
! newPathList = (char **)ILRealloc
! (systemPath, (systemPathSize + 1) * sizeof(char *));
! if(!newPathList)
{
! return;
}
! systemPath = newPathList;
! systemPath[systemPathSize] = ILDupNString(path, len);
! if(!(systemPath[systemPathSize]))
{
! return;
}
- ++systemPathSize;
}
--- 35,86 ----
/*
! * The cached system path, loaded from the environment. The "important"
! * system path is searched before looking in the same directory as the
! * assembly, to prevent conflicts with foreign CLI's for core libraries.
*/
static char **systemPath = 0;
static int systemPathSize = 0;
! static char **importantSystemPath = 0;
! static int importantSystemPathSize = 0;
/*
* Add a pathname to "systemPaths".
*/
! static void AddSystemPath(const char *path, int len, int importantPath)
{
char **newPathList;
! if(importantPath)
{
! newPathList = (char **)ILRealloc
! (importantSystemPath,
! (importantSystemPathSize + 1) * sizeof(char *));
! if(!newPathList)
! {
! return;
! }
! importantSystemPath = newPathList;
! importantSystemPath[importantSystemPathSize] =
ILDupNString(path, len);
! if(!(importantSystemPath[importantSystemPathSize]))
! {
! return;
! }
! ++importantSystemPathSize;
}
! else
{
! newPathList = (char **)ILRealloc
! (systemPath, (systemPathSize + 1) * sizeof(char *));
! if(!newPathList)
! {
! return;
! }
! systemPath = newPathList;
! systemPath[systemPathSize] = ILDupNString(path, len);
! if(!(systemPath[systemPathSize]))
! {
! return;
! }
! ++systemPathSize;
}
}
***************
*** 77,81 ****
* Split a pathname list and add it to the global list of system paths.
*/
! static void SplitPathString(char *list, char *stdpath, char *defaultPath)
{
int len;
--- 88,93 ----
* Split a pathname list and add it to the global list of system paths.
*/
! static void SplitPathString(char *list, char *stdpath, char *defaultPath,
! int importantPath)
{
int len;
***************
*** 88,92 ****
if(stdpath)
{
! AddSystemPath(stdpath, strlen(stdpath));
ILFree(stdpath);
stdpath = 0;
--- 100,104 ----
if(stdpath)
{
! AddSystemPath(stdpath, strlen(stdpath), importantPath);
ILFree(stdpath);
stdpath = 0;
***************
*** 163,167 ****
/* Add the path to the global list */
! AddSystemPath(list, len);
/* Advance to the next path */
--- 175,179 ----
/* Add the path to the global list */
! AddSystemPath(list, len, importantPath);
/* Advance to the next path */
***************
*** 176,189 ****
{
#if !defined(__palmos__)
! if(!systemPath)
{
SplitPathString(getenv("CSCC_LIB_PATH"),
ILGetStandardLibraryPath("cscc/lib"),
! CSCC_LIB_PATH_DEFAULT);
! SplitPathString(getenv("MONO_PATH"),
ILGetStandardLibraryPath(0), 0);
! SplitPathString(getenv("LD_LIBRARY_PATH"), 0,
LD_LIBRARY_PATH_DEFAULT);
#ifdef IL_WIN32_PLATFORM
/* Win32: try looking in PATH also, since Win32 puts dll's
there */
! SplitPathString(getenv("PATH"), 0, 0);
#endif
}
--- 188,203 ----
{
#if !defined(__palmos__)
! if(!systemPath && !importantSystemPath)
{
SplitPathString(getenv("CSCC_LIB_PATH"),
ILGetStandardLibraryPath("cscc/lib"),
! CSCC_LIB_PATH_DEFAULT, 1);
! SplitPathString(getenv("MONO_PATH"),
! ILGetStandardLibraryPath(0), 0,
0);
! SplitPathString(getenv("LD_LIBRARY_PATH"), 0,
! LD_LIBRARY_PATH_DEFAULT, 0);
#ifdef IL_WIN32_PLATFORM
/* Win32: try looking in PATH also, since Win32 puts dll's
there */
! SplitPathString(getenv("PATH"), 0, 0, 0);
#endif
}
***************
*** 413,417 ****
{
int namelen;
- unsigned long posn;
char *path;
char *firstPath;
--- 427,430 ----
***************
*** 443,459 ****
/* Is this a system assembly that we must handle specially? */
isSystem = 0;
! for(posn = 0; posn < systemAssembliesSize; ++posn)
{
! if(namelen == strlen(systemAssemblies[posn]) &&
! !strncmp(systemAssemblies[posn], name, namelen))
{
! isSystem = 1;
! break;
}
}
/* Look in the same directory as the parent assembly */
- firstPath = 0;
if(sameDir)
{
--- 456,489 ----
/* Is this a system assembly that we must handle specially? */
+ /* Note: system check is no longer necessary - remove eventually */
isSystem = 0;
!
! /* Initialize flag variables for the search */
! if(sameDir)
{
! *sameDir = 0;
! }
! firstPath = 0;
!
! /* Search the before path list */
! if(FindAssemblyInPaths(beforePaths, numBeforePaths, name, namelen,
! isSystem, &path, &firstPath))
! {
! return path;
! }
!
! /* Search the "important" standard system paths */
! if(!suppressStandardPaths)
! {
! LoadSystemPath();
! if(FindAssemblyInPaths((const char **)importantSystemPath,
! (unsigned
long)importantSystemPathSize,
! name, namelen,
isSystem, &path, &firstPath))
{
! return path;
}
}
/* Look in the same directory as the parent assembly */
if(sameDir)
{
***************
*** 488,498 ****
}
- /* Search the before path list */
- if(FindAssemblyInPaths(beforePaths, numBeforePaths, name, namelen,
- isSystem, &path, &firstPath))
- {
- return path;
- }
-
/* Search the standard system paths */
if(!suppressStandardPaths)
--- 518,521 ----
***************
*** 1083,1086 ****
--- 1106,1121 ----
/* Look on the standard system search path */
LoadSystemPath();
+ for(posn = 0; posn < importantSystemPathSize; ++posn)
+ {
+ fullName = TestPathForNativeLib(importantSystemPath[posn],
+
strlen(importantSystemPath[posn]),
+
baseName, strlen(baseName),
+
optPrefix, suffix);
+ if(fullName)
+ {
+ ILFree(baseName);
+ return fullName;
+ }
+ }
for(posn = 0; posn < systemPathSize; ++posn)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnet/image link.c,1.28,1.29,
Rhys Weatherley <address@hidden> <=