Full_Name: Jonathan Tuke Version: 2.4.0 OS: Mac OS X 10.4.8 Submission from: (NULL) (203.173.46.189) I am writing C code to implement in R. I am using R CMD SHLIB and then dyn.load("file.so"). The function I then call with .C("function"). Since I installed the latest R version, I have found that if I alter my C code and recompile, then use dyn.load("file.so"), the function in R is not updated but remains as the previous code. I have tried dyn.unload, but when I use dyn.load() the initially loaded code is used. The only way to load the updated c code is to quit R and then reopen. Thanks, Jono
In OS X you cannot "unload" dynamically linked code. This is a known "feature" of OS X :( This is not an R bug. stefano On 15/nov/06, at 15:27, tuke at senet.com.au wrote:> Full_Name: Jonathan Tuke > Version: 2.4.0 > OS: Mac OS X 10.4.8 > Submission from: (NULL) (203.173.46.189) > > > I am writing C code to implement in R. I am using R CMD SHLIB and then > dyn.load("file.so"). The function I then call with .C("function"). > Since I > installed the latest R version, I have found that if I alter my C > code and > recompile, then use dyn.load("file.so"), the function in R is not > updated but > remains as the previous code. I have tried dyn.unload, but when I > use dyn.load() > the initially loaded code is used. The only way to load the updated > c code is to > quit R and then reopen. > > Thanks, > Jono > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I was just testing this myself on various machines. And it behaves on Linux, Windows and also on my Intel Mac (OS X 10.4.8). Stefano, is this restriction on OS X still in effect? (Unfortunately I can't test this on any of my Power PC macs just at the moment. Just building R-2.4-0 one one of them.) There is test code available at www.omegahat.org/Misc/Rdynunload.tar.gz The script run.R does the builds and load and unloads and runs the entire test. Without a programmatic test it is easy to test the wrong thing. D. stefano iacus wrote:> In OS X you cannot "unload" dynamically linked code. This is a known > "feature" of OS X :( > This is not an R bug. > > stefano > > On 15/nov/06, at 15:27, tuke at senet.com.au wrote: > > >>Full_Name: Jonathan Tuke >>Version: 2.4.0 >>OS: Mac OS X 10.4.8 >>Submission from: (NULL) (203.173.46.189) >> >> >>I am writing C code to implement in R. I am using R CMD SHLIB and then >>dyn.load("file.so"). The function I then call with .C("function"). >>Since I >>installed the latest R version, I have found that if I alter my C >>code and >>recompile, then use dyn.load("file.so"), the function in R is not >>updated but >>remains as the previous code. I have tried dyn.unload, but when I >>use dyn.load() >>the initially loaded code is used. The only way to load the updated >>c code is to >>quit R and then reopen. >> >>Thanks, >>Jono >> >>______________________________________________ >>R-devel at r-project.org mailing list >>https://stat.ethz.ch/mailman/listinfo/r-devel >> > > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel- -- Duncan Temple Lang duncan at wald.ucdavis.edu Department of Statistics work: (530) 752-4782 4210 Mathematical Sciences Building fax: (530) 752-7099 One Shields Ave. University of California at Davis Davis, CA 95616, USA -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin) iD8DBQFFWy0Y9p/Jzwa2QP4RAnN1AJ9Az6aBRcJWBNPvsn/1BmDb8wA4LACfaxWP dGWqKjqt98xG50LDRJoo4uY=EoRV -----END PGP SIGNATURE-----
I'll test your script. Simon also made the same remark. Maybe in 10.4 this problem is solved. But apparently, if I load a package and then try to detach it, R still keeps open the .so file for that package. Is this expected for a successful unload (given that I never had experience of a successful unload I can't tell)? (I'm using ppc) stefano On 16/nov/06, at 00:07, Duncan Temple Lang wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > I was just testing this myself on various machines. > And it behaves on Linux, Windows and also on > my Intel Mac (OS X 10.4.8). > > Stefano, is this restriction on OS X still in effect? > (Unfortunately I can't test this on any of my Power PC macs > just at the moment. Just building R-2.4-0 one one of them.) > > There is test code available at > www.omegahat.org/Misc/Rdynunload.tar.gz > > The script run.R does the builds and load and unloads > and runs the entire test. Without a programmatic test > it is easy to test the wrong thing. > > D. > > stefano iacus wrote: >> In OS X you cannot "unload" dynamically linked code. This is a known >> "feature" of OS X :( >> This is not an R bug. >> >> stefano >> >> On 15/nov/06, at 15:27, tuke at senet.com.au wrote: >> >> >>> Full_Name: Jonathan Tuke >>> Version: 2.4.0 >>> OS: Mac OS X 10.4.8 >>> Submission from: (NULL) (203.173.46.189) >>> >>> >>> I am writing C code to implement in R. I am using R CMD SHLIB and >>> then >>> dyn.load("file.so"). The function I then call with .C("function"). >>> Since I >>> installed the latest R version, I have found that if I alter my C >>> code and >>> recompile, then use dyn.load("file.so"), the function in R is not >>> updated but >>> remains as the previous code. I have tried dyn.unload, but when I >>> use dyn.load() >>> the initially loaded code is used. The only way to load the updated >>> c code is to >>> quit R and then reopen. >>> >>> Thanks, >>> Jono >>> >>> ______________________________________________ >>> R-devel at r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-devel >>> >> >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel > > - -- > Duncan Temple Lang duncan at wald.ucdavis.edu > Department of Statistics work: (530) 752-4782 > 4210 Mathematical Sciences Building fax: (530) 752-7099 > One Shields Ave. > University of California at Davis > Davis, > CA 95616, > USA > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.3 (Darwin) > > iD8DBQFFWy0Y9p/Jzwa2QP4RAnN1AJ9Az6aBRcJWBNPvsn/1BmDb8wA4LACfaxWP > dGWqKjqt98xG50LDRJoo4uY> =EoRV > -----END PGP SIGNATURE-----
here is the output > source("run.R") gcc-4.0 -arch ppc -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/ppc -I/usr/local/ include -fPIC -g -O2 -std=gnu99 -c code.c -o code.o gcc-4.0 -arch ppc -dynamiclib -Wl,-macosx_version_min -Wl,10.3 - undefined dynamic_lookup -single_module -multiply_defined suppress -L/ usr/local/lib -o foo.so code.o -L/Library/Frameworks/R.framework/ Resources/lib/ppc -lR -dylib_file libRblas.dylib:/Library/Frameworks/ R.framework/Resources/lib/ppc/libRblas.dylib loaded DLL/SO first attempt gcc-4.0 -arch ppc -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/ppc -I/usr/local/ include -fPIC -g -O2 -std=gnu99 -c other.c -o other.o gcc-4.0 -arch ppc -dynamiclib -Wl,-macosx_version_min -Wl,10.3 - undefined dynamic_lookup -single_module -multiply_defined suppress -L/ usr/local/lib -o foo.so other.o -L/Library/Frameworks/R.framework/ Resources/lib/ppc -lR -dylib_file libRblas.dylib:/Library/Frameworks/ R.framework/Resources/lib/ppc/libRblas.dylib loaded DLL/SO first attempt [1] "Failed" On 16/nov/06, at 00:07, Duncan Temple Lang wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > I was just testing this myself on various machines. > And it behaves on Linux, Windows and also on > my Intel Mac (OS X 10.4.8). > > Stefano, is this restriction on OS X still in effect? > (Unfortunately I can't test this on any of my Power PC macs > just at the moment. Just building R-2.4-0 one one of them.) > > There is test code available at > www.omegahat.org/Misc/Rdynunload.tar.gz > > The script run.R does the builds and load and unloads > and runs the entire test. Without a programmatic test > it is easy to test the wrong thing. > > D. > > stefano iacus wrote: >> In OS X you cannot "unload" dynamically linked code. This is a known >> "feature" of OS X :( >> This is not an R bug. >> >> stefano >> >> On 15/nov/06, at 15:27, tuke at senet.com.au wrote: >> >> >>> Full_Name: Jonathan Tuke >>> Version: 2.4.0 >>> OS: Mac OS X 10.4.8 >>> Submission from: (NULL) (203.173.46.189) >>> >>> >>> I am writing C code to implement in R. I am using R CMD SHLIB and >>> then >>> dyn.load("file.so"). The function I then call with .C("function"). >>> Since I >>> installed the latest R version, I have found that if I alter my C >>> code and >>> recompile, then use dyn.load("file.so"), the function in R is not >>> updated but >>> remains as the previous code. I have tried dyn.unload, but when I >>> use dyn.load() >>> the initially loaded code is used. The only way to load the updated >>> c code is to >>> quit R and then reopen. >>> >>> Thanks, >>> Jono >>> >>> ______________________________________________ >>> R-devel at r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-devel >>> >> >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel > > - -- > Duncan Temple Lang duncan at wald.ucdavis.edu > Department of Statistics work: (530) 752-4782 > 4210 Mathematical Sciences Building fax: (530) 752-7099 > One Shields Ave. > University of California at Davis > Davis, > CA 95616, > USA > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.3 (Darwin) > > iD8DBQFFWy0Y9p/Jzwa2QP4RAnN1AJ9Az6aBRcJWBNPvsn/1BmDb8wA4LACfaxWP > dGWqKjqt98xG50LDRJoo4uY> =EoRV > -----END PGP SIGNATURE-----