The R Project SVN R

Rev

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

Rev 75796 Rev 76974
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1997-2018 The R Core Team
3
 *  Copyright (C) 1997-2019 The R Core Team
4
 *  Copyright (C) 1995-1996 Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 1995-1996 Robert Gentleman and Ross Ihaka
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  the Free Software Foundation; either version 2 of the License, or
Line 929... Line 929...
929
    DllInfo *info;
929
    DllInfo *info;
930
 
930
 
931
    checkArity(op,args);
931
    checkArity(op,args);
932
    if (!isString(CAR(args)) || LENGTH(CAR(args)) != 1)
932
    if (!isString(CAR(args)) || LENGTH(CAR(args)) != 1)
933
	error(_("character argument expected"));
933
	error(_("character argument expected"));
934
    GetFullDLLPath(call, buf, translateChar(STRING_ELT(CAR(args), 0)));
934
    GetFullDLLPath(call, buf, translateCharFP(STRING_ELT(CAR(args), 0)));
935
    /* AddDLL does this DeleteDLL(buf); */
935
    /* AddDLL does this DeleteDLL(buf); */
936
    info = AddDLL(buf, LOGICAL(CADR(args))[0], LOGICAL(CADDR(args))[0],
936
    info = AddDLL(buf, LOGICAL(CADR(args))[0], LOGICAL(CADDR(args))[0],
937
		  translateChar(STRING_ELT(CADDDR(args), 0)));
937
		  translateCharFP(STRING_ELT(CADDDR(args), 0)));
938
    if(!info)
938
    if(!info)
939
	error(_("unable to load shared object '%s':\n  %s"), buf, DLLerror);
939
	error(_("unable to load shared object '%s':\n  %s"), buf, DLLerror);
940
    return(Rf_MakeDLLInfo(info));
940
    return(Rf_MakeDLLInfo(info));
941
}
941
}
942
 
942
 
Line 945... Line 945...
945
    char buf[2 * PATH_MAX];
945
    char buf[2 * PATH_MAX];
946
 
946
 
947
    checkArity(op,args);
947
    checkArity(op,args);
948
    if (!isString(CAR(args)) || LENGTH(CAR(args)) != 1)
948
    if (!isString(CAR(args)) || LENGTH(CAR(args)) != 1)
949
	error(_("character argument expected"));
949
	error(_("character argument expected"));
950
    GetFullDLLPath(call, buf, translateChar(STRING_ELT(CAR(args), 0)));
950
    GetFullDLLPath(call, buf, translateCharFP(STRING_ELT(CAR(args), 0)));
951
    if(!DeleteDLL(buf))
951
    if(!DeleteDLL(buf))
952
	error(_("shared object '%s\' was not loaded"), buf);
952
	error(_("shared object '%s\' was not loaded"), buf);
953
    return R_NilValue;
953
    return R_NilValue;
954
}
954
}
955
 
955
 
Line 1139... Line 1139...
1139
    SEXP sym = R_NilValue;
1139
    SEXP sym = R_NilValue;
1140
    DL_FUNC f = NULL;
1140
    DL_FUNC f = NULL;
1141
 
1141
 
1142
    package = "";
1142
    package = "";
1143
 
1143
 
1144
    name = translateChar(STRING_ELT(sname, 0));
1144
    name = translateCharFP(STRING_ELT(sname, 0));
1145
 
1145
 
1146
    if(length(spackage)) {
1146
    if(length(spackage)) {
1147
	if(TYPEOF(spackage) == STRSXP)
1147
	if(TYPEOF(spackage) == STRSXP)
1148
	    package = translateChar(STRING_ELT(spackage, 0));
1148
	    package = translateCharFP(STRING_ELT(spackage, 0));
1149
	else if(TYPEOF(spackage) == EXTPTRSXP &&
1149
	else if(TYPEOF(spackage) == EXTPTRSXP &&
1150
		R_ExternalPtrTag(spackage) == install("DLLInfo")) {
1150
		R_ExternalPtrTag(spackage) == install("DLLInfo")) {
1151
	    f = R_dlsym((DllInfo *) R_ExternalPtrAddr(spackage), name, &symbol);
1151
	    f = R_dlsym((DllInfo *) R_ExternalPtrAddr(spackage), name, &symbol);
1152
	    package = NULL;
1152
	    package = NULL;
1153
	} else
1153
	} else
Line 1363... Line 1363...
1363
    SEXP sname = CAR(args), spackage = CADR(args),
1363
    SEXP sname = CAR(args), spackage = CADR(args),
1364
	withRegistrationInfo = CADDR(args);
1364
	withRegistrationInfo = CADDR(args);
1365
 
1365
 
1366
    if (!isString(sname) || LENGTH(sname) != 1)
1366
    if (!isString(sname) || LENGTH(sname) != 1)
1367
	error(_("invalid '%s' argument"), "name");
1367
	error(_("invalid '%s' argument"), "name");
1368
    name = translateChar(STRING_ELT(sname, 0));
1368
    name = translateCharFP(STRING_ELT(sname, 0));
1369
    if(length(spackage)) {
1369
    if(length(spackage)) {
1370
	if(TYPEOF(spackage) == STRSXP)
1370
	if(TYPEOF(spackage) == STRSXP)
1371
	    package = translateChar(STRING_ELT(spackage, 0));
1371
	    package = translateCharFP(STRING_ELT(spackage, 0));
1372
	else if(TYPEOF(spackage) == EXTPTRSXP &&
1372
	else if(TYPEOF(spackage) == EXTPTRSXP &&
1373
		R_ExternalPtrTag(spackage) == install("DLLInfo")) {
1373
		R_ExternalPtrTag(spackage) == install("DLLInfo")) {
1374
	    f = R_dlsym((DllInfo *) R_ExternalPtrAddr(spackage), name, &symbol);
1374
	    f = R_dlsym((DllInfo *) R_ExternalPtrAddr(spackage), name, &symbol);
1375
	    package = NULL;
1375
	    package = NULL;
1376
	} else
1376
	} else