Jon A. Rønningen <jon.a.ronningen@...> writes: > > > > Dear all. > > I am working on getting NLOpt to work on Intel Fortran for Windows using the precompiled DLL. Any help or prior experience regarding this would be highly appreciated. Please see the description of the problem below. > > The ifort compiler requires a .lib file as a link to the DLL file, and I have created it from the provided .def file using > the lib command from the Microsoft Library Manager (alt. dlltool from MinGW): > > 1. > lib /def:libnlopt-0.def > > Checking the .lib file using dumpbin gives reasonable results: > > 2. > dumpbin –exports libnlopt-0.lib > > (snip) > > Dump of file libnlopt-0.lib > > File Type: LIBRARY > > Exports > > ordinal name > > _nlo_add_equality_constraint > _nlo_add_equality_constraint_ > _nlo_add_equality_constraint__ > _nlo_add_equality_mconstraint > _nlo_add_equality_mconstraint_ > _nlo_add_equality_mconstraint__ > _nlo_add_inequality_constraint > _nlo_add_inequality_constraint_ > _nlo_add_inequality_constraint__ > _nlo_add_inequality_mconstraint > _nlo_add_inequality_mconstraint_ > _nlo_add_inequality_mconstraint__ > _nlo_copy > _nlo_copy_ > _nlo_copy__ > _nlo_create > _nlo_create_ > _nlo_create__ > ….. > (snip) > > I then try to compile the example provided in the tutorial (“Example in Fortran”, two subroutines and one main program), calling the Fortran compiler: > > 3. > ifort nlopttest.f90 libnlopt-0.lib > > This gives an error message: > > Microsoft (R) Incremental Linker Version 9.00.21022.08 > Copyright (C) Microsoft Corporation. All rights reserved. > > -out:nlopttest.exe > -subsystem:console > nlopttest.obj > libnlopt-0.lib > nlopttest.obj : error LNK2019: unresolved external symbol _NLO_CREATE referenced in function _MAIN__ > nlopttest.obj : error LNK2019: unresolved external symbol _NLO_GET_LOWER_BOUNDS referenced in function _MAIN__ > nlopttest.obj : error LNK2019: unresolved external symbol _NLO_SET_LOWER_BOUNDS referenced in function _MAIN__ > nlopttest.obj : error LNK2019: unresolved external symbol _NLO_SET_MIN_OBJECTIVE referenced in function _MAIN__ > nlopttest.obj : error LNK2019: unresolved external symbol _NLO_ADD_INEQUALITY_CONSTRAINT referenced in function _MAIN__ > nlopttest.obj : error LNK2019: unresolved external symbol _NLO_SET_XTOL_REL referenced in function _MAIN__ > nlopttest.obj : error LNK2019: unresolved external symbol _NLO_OPTIMIZE referenced in function _MAIN__ > nlopttest.obj : error LNK2019: unresolved external symbol _NLO_DESTROY referenced in function _MAIN__ > nlopttest.exe : fatal error LNK1120: 8 unresolved externals > > I asked on the Intel Fortran forum and it was suspected that the ”linker name that Fortran generated for the references to the procedures are not the same as the actual symbol names in the DLL. What > I suspect is going on is that the linker symbol name that Fortran generates for the references to the procedures in your library are not the same as the actual symbol names in the DLL. Unless the DLL was generated > from Fortran source compiled by the same compiler, you generally need to provide the compiler of code that uses the DLL with additional information, typically via INTERFACE blocks, about the calling conventions associated with the procedures in the DLL (calling > convention including aspects such as how to map the name of something in source code to a linker symbol name, amongst other important things”. > > Any help would be appreciated. Many thanks. > > Kind Regards > Jon > I just tried implementing Steve's solution by putting /Qlowercase /assume:underscore in Project-->Properties-->Fortran-->Command Line.
It seems to finally compile successfully, though with the following comment: "ifort: command line remark #10010: option '/Qlowercase' is deprecated and will be removed in a future release. Is this important? In any case, when I try to run the compiled program (which consists solely of the Tutorial program on the NLopt website), I get the following error from Windows: "The program can't start because libnlopt-0.dll is missing from your computer. Try reinstalling the program to fix this problem." What could be causing this problem? The libnlopt-0.dll file is in the same folder as the .lib file I created and linked to in Visual Studio. Do these files need to be in some other directory? _______________________________________________ NLopt-discuss mailing list [email protected] http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss
