From ncrook@ton@|@ @end|ng |rom gm@||@com  Tue Dec  3 22:41:56 2019
From: ncrook@ton@|@ @end|ng |rom gm@||@com (Nicholas Crookston)
Date: Tue, 3 Dec 2019 13:41:56 -0800
Subject: [Rd] Dynamic load library problem using R 4.0.0
Message-ID: <CAAk+MXz+XSXaFcogbRPBPPyWzUzM8-Mg=1DfU6WOUXuDrEfK0A@mail.gmail.com>

I'm having problems getting code that runs under 3.6.1 on MacOSX (and
Ubuntu)
to run the R version 4.0.0 on Windows. I have not tested R 4.0.0 on mac
(yet).

Key question: Has anything changed in R 4.0.0/Windows regarding how
dynamically loaded
libraries are accessed?  Can someone please point me in the right direction?

WORKS On MacOSX Under:
R version 3.6.1 (2019-07-05) -- "Action of the Toes"
after dynamically loading ../../bin/qFVSie.so:

> getLoadedDLLs()$qFVSie
DLL name: qFVSie
Filename:

/Users/ncrookston/open-fvs/branches/NickDev/tests/APIviaR/../../bin/qFVSie.so
Dynamic lookup: TRUE

# expected output is correct:
> i=1
> .C("CfvsSpeciesCode",fvs_code="",fia_code="",plant_code="",
indx=as.integer(i))
$fvs_code
[1] "WP"
$fia_code
[1] "119"
$plant_code
[1] "PIMO3"
$indx
[1] 1

----- from the nm command:
$ nm ../../bin/qFVSie.so | grep -i cfvsspeciescode
00000000000a7980 T _CfvsSpeciesCode

------------------------------------

Fails On Win10 Under:
R version 4.0.0 Under development (Rtools 4.0) (2019-11-23 r77455) --
"Blame Jeroen"
NOTE: The .dll is built using the most recent Rtools as advised by Jeroen.

> getLoadedDLLs()$qFVSie
DLL name: qFVSie
Filename:

C:/Users/nickc/open-fvs/branches/NickDev/tests/APIviaR/../../bin/qFVSie.dll
Dynamic lookup: TRUE

> i=1
> .C("CfvsSpeciesCode",fvs_code="",fia_code="",plant_code="",
indx=as.integer(i))
Error in .C("CfvsSpeciesCode", fvs_code = "", fia_code = "", plant_code =
"",  :
  C symbol name "CfvsSpeciesCode" not in load table

----- from the nm command on Win10:
nm ../../bin/qFVSie.dll | grep -i cfvsspeciescode
00000000707a21f0 T CfvsSpeciesCode

-----------------------------------

If advised to do so, I'll create a simple and fully reproducible example,
but perhaps
I missing something simple (like compiler switch needed to create my .dll
that has not
been necessary until now).

Thanks, Nick

-- 
Nicholas L. Crookston
Forestry Research Consultant
Moscow Idaho USA

	[[alternative HTML version deleted]]



[Rd] Dynamic load library problem using R 4.0.0
Nicholas Crookston