On Thu, 29 Mar 2007, Paul August wrote: > Hi, > > I wonder where I can find an example of using a function in LAPACK > library in a user's own C code.
In about 20 R packages, e.g. the recommended package mgcv. > I wrote a C program which will be > compiled and linked to produce a DLL file and then loaded into R. I hope > to use a function from LAPACK library, for example, dgesdd, in the > program. Following R manual, I call the function by F77_CALL(dgesdd) in > the program. The program can be compiled without problems. However, when > it is linked to produce a DLL file, I get an error message > > Test.obj : error LNK2001: unresolved external symbol _dgesdd_ > Test.dll : fatal error LNK1120: 1 unresolved externals > > I use VC++6.0 and the command of linking is something like this > > link.exe Rdll.lib /nologo /dll /out:Test.dll > /libpath:C:\R\R-2.2.1\src\gnuwin32 Test.obj > > Apparently, the linker cannot resolve dgesdd from Rdll.lib. If anyone > knows what I missed here or any example that shows how this can be done > properly, please let me know. Thanks a lot. It is in Rlapack.dll not R.dll. The linking information is in 'Writing R Extensions' for those using the recommended compilation system (search for LAPACK_LIBS). You will need to build an import library for Rlapack.dll and link against that. And BTW you seem to be using R 2.2.1: please update as we can only offer accurate advice on recent systems. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.