to call a DLL from another Fortran DLL in another topic Steve Lionel (Intel) wrote that there is an example from Intel, but I can't find.
Is someone able to help me?
If you have the .lib that was generated when the DLL to be called was built, just add that .lib to your project, As long as both DLLs can be found by Windows where it looks for them (location of the EXE or in a folder named in the PATH environment variable), that's all you have to do.
Making an import library from a DLL can be performed using the following steps and the Visual Studio tools that are installed along with Intel compilers.
- Run dumpbin /exports <mydll.dll> > mydll.def OR, if you already know the list of names to be used, put that list into mydll.def.
- Edit mydll.def and follow the guidelines at https://msdn.microsoft.com/en-us/library/28d6s79h.aspx .
- lib /machine:i386 /def:mydll.def
After you have done these steps, you should have the import library mydll.lib, which you can link with your projects that will use the DLL.
Hi Steve, hi all,
sorry for my late answer. I had a business trip. The name of my function is correct, I think.
Attached is the Dependency Walker output for my function. I call it x=os_min( ...)
Next I like to try dumpbin.exe. How I have to do that? In DOS? And ok, if nessary I try the DEF-File.
By the way I work with Visual Studio 2017 Version 15.7.5 and Intel Parallel XE 2018 Update 3 Composer Edition for Fortran.
The @88 means that it is a STDCALL procedure. Try adding this in the procedure where you call it:
!DEC$ ATTRIBUTES STDCALL, REFERENCE :: OS_MIN
That there are 22 arguments means that it's likely you will need something more to pass the arguments correctly. How is os_min declared in the source for the DLL? I want to see the procedure declaration and the declarations of all its arguments.
I note that the routine name is lowercase, which means it wasn't built with default options in any Fortran compiler.
No, that are 11 arguments, because they are double precision.
After I adding your phrase, I have this:
error #6406: Conflicting attributes or multiple declaration of name. [OS_MIN]
and if I delete the convention double precision :: os_min there is this:
error #6404: This name does not have a type, and must have an explicit type. [OS_MIN]
If the arguments are double precision, then remove ", REFERENCE" from the ATTRIBUTES line. Do you have another directive naming OS_MIN? You do also need a type declaration, as it would seem you have IMPLICIT NONE.
May I ask you some an advice to load rc.exe because it is not present on my PC.
My environment is VS2015 + parallel_studio_xe_2015_update6_online_setup.exe (for FORTRAN).
I need that to call a DLL Fortranin XExcel Office365 x64.
Thks in advance for your help.
rc.exe is part of VS2015's C++ support. Make sure you followed the steps in https://software.intel.com/en-us/articles/installing-visual-studio-2015-for-use-with-intel-compilers