The R Project SVN R

Rev

Rev 44177 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 44177 Rev 45070
Line 50... Line 50...
50
int setDLLSearchPath(const char *path)
50
int setDLLSearchPath(const char *path)
51
{
51
{
52
    int res = 0; /* failure */
52
    int res = 0; /* failure */
53
    PSDD p = (PSDD) -1;
53
    PSDD p = (PSDD) -1;
54
    static char wd[MAX_PATH] = "";  /* stored real current directory */
54
    static char wd[MAX_PATH] = "";  /* stored real current directory */
55
    
55
 
56
    if(p == (PSDD) -1)
56
    if(p == (PSDD) -1)
57
	p = (PSDD) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
57
	p = (PSDD) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
58
				  "SetDllDirectoryA");
58
				  "SetDllDirectoryA");
59
    if(p) {
59
    if(p) {
60
	res = p(path);
60
	res = p(path);
Line 72... Line 72...
72
 
72
 
73
#include <R_ext/Rdynload.h>
73
#include <R_ext/Rdynload.h>
74
#include <Rdynpriv.h>
74
#include <Rdynpriv.h>
75
 
75
 
76
 
76
 
77
        /* Inserts the specified DLL at the head of the DLL list */
77
	/* Inserts the specified DLL at the head of the DLL list */
78
        /* Returns 1 if the library was successfully added */
78
	/* Returns 1 if the library was successfully added */
79
        /* and returns 0 if the library table is full or */
79
	/* and returns 0 if the library table is full or */
80
        /* or if LoadLibrary fails for some reason. */
80
	/* or if LoadLibrary fails for some reason. */
81
 
81
 
82
static void fixPath(char *path)
82
static void fixPath(char *path)
83
{
83
{
84
    char *p;
84
    char *p;
85
    for(p = path; *p != '\0'; p++) if(*p == '\\') *p = '/';
85
    for(p = path; *p != '\0'; p++) if(*p == '\\') *p = '/';
86
}
86
}
87
 
87
 
88
static HINSTANCE R_loadLibrary(const char *path, int asLocal, int now, 
88
static HINSTANCE R_loadLibrary(const char *path, int asLocal, int now,
89
			       const char *search);
89
			       const char *search);
90
static DL_FUNC getRoutine(DllInfo *info, char const *name);
90
static DL_FUNC getRoutine(DllInfo *info, char const *name);
91
static void R_deleteCachedSymbols(DllInfo *dll);
91
static void R_deleteCachedSymbols(DllInfo *dll);
92
 
92
 
93
static void R_getDLLError(char *buf, int len);
93
static void R_getDLLError(char *buf, int len);
Line 124... Line 124...
124
	    } else nCPFun--;
124
	    } else nCPFun--;
125
	}
125
	}
126
}
126
}
127
 
127
 
128
#ifndef _MCW_EM
128
#ifndef _MCW_EM
129
_CRTIMP unsigned int __cdecl 
129
_CRTIMP unsigned int __cdecl
130
_controlfp (unsigned int unNew, unsigned int unMask);
130
_controlfp (unsigned int unNew, unsigned int unMask);
131
_CRTIMP unsigned int __cdecl _clearfp (void);
131
_CRTIMP unsigned int __cdecl _clearfp (void);
132
/* Control word masks for unMask */
132
/* Control word masks for unMask */
133
#define	_MCW_EM		0x0008001F	/* Error masks */
133
#define	_MCW_EM		0x0008001F	/* Error masks */
134
#define	_MCW_IC		0x00040000	/* Infinity */
134
#define	_MCW_IC		0x00040000	/* Infinity */
135
#define	_MCW_RC		0x00000300	/* Rounding */
135
#define	_MCW_RC		0x00000300	/* Rounding */
136
#define	_MCW_PC		0x00030000	/* Precision */
136
#define	_MCW_PC		0x00030000	/* Precision */
137
#endif
137
#endif
138
 
138
 
139
HINSTANCE R_loadLibrary(const char *path, int asLocal, int now, 
139
HINSTANCE R_loadLibrary(const char *path, int asLocal, int now,
140
			const char *search)
140
			const char *search)
141
{
141
{
142
    HINSTANCE tdlh;
142
    HINSTANCE tdlh;
143
    unsigned int dllcw, rcw;
143
    unsigned int dllcw, rcw;
144
    int useSearch = search && search[0];
144
    int useSearch = search && search[0];
Line 196... Line 196...
196
    } else
196
    } else
197
	strcpy(buf, path);
197
	strcpy(buf, path);
198
    /* fix slashes to allow inconsistent usage later */
198
    /* fix slashes to allow inconsistent usage later */
199
    for (p = buf; *p; p++) if (*p == '\\') *p = '/';
199
    for (p = buf; *p; p++) if (*p == '\\') *p = '/';
200
}
200
}
201
 
-