Skip to content

Commit f4c2c57

Browse files
committed
When dynamically loading symbol: check also the name with trailing underscore (like GNU-R)
1 parent c3665c8 commit f4c2c57

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Bug fixes:
2929
Added missing R builtins and C APIs
3030

3131
* Dummy implementations of `X_IS_SORTED` and `X_NO_NA` for `X = STRING,INTEGER,REAL` #156
32+
* when loading native symbol dynamically, FastR also checks the name with trailing underscode to be compatible with GNU-R
3233

3334
# 20.1.0
3435

com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DLL.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,14 @@ public SymbolHandle execute(DLLInfo dllInfo, String name, RegisteredNativeSymbol
879879
if (rns != null && rns.nst == NativeSymbolType.Fortran) {
880880
mName = name.toLowerCase() + "_";
881881
}
882+
SymbolHandle result = dynamicLookup(dllInfo, mName);
883+
if (result == SYMBOL_NOT_FOUND && rns != null && rns.nst == NativeSymbolType.Any) {
884+
result = dynamicLookup(dllInfo, name + "_");
885+
}
886+
return result;
887+
}
888+
889+
private SymbolHandle dynamicLookup(DLLInfo dllInfo, String mName) {
882890
try {
883891
if (dllInfo.unsuccessfulLookups.contains(mName)) {
884892
return SYMBOL_NOT_FOUND;

0 commit comments

Comments
 (0)