Hi Steve, hi all,
you helped me not long ago for usind the function os_min in a differernt dll. That worked when I added the lib-File of the dll to my project (right click on the project and add) and used
!DEC$ ATTRIBUTES STDCALL :: OS_MIN
(!DEC$ ATTRIBUTES STDCALL, REFERENCE :: OS_MIN, if there were real arguments. not double precision)
in my code
and set the path to the lib.
But now (for my next application) I need a function in a dll but don't have a lib-file. I tried it by adding directly the dll-File. But it didn't work.
What I did wrong? Can you help me?
One can't link to a DLL, you need the .lib. You can create a .lib via a .def file as explained at https://adrianhenke.wordpress.com/2008/12/05/create-lib-file-from-dll/
Another choice is dynamic activation of the DLL - this is demonstrated in the compiler_f\DLL\DynamicLoad sample in the Intel Parallel Studio XE for Windows Sample Bundle.
You're referring to your other thread on QuickWin? Post there and explain what "didn't work". USE has no direct relationship with DLL calls.
no I referring to this topic here (call a DLL from Fortran - second part).
I create this lib-File like you said.Without the USE it works, then I expand it and got while compiling the error "This name has not been declared as an array or a function. [NPAR]" and for other variabliables the same error.
Ok, if you say, that USE has no direct relationship with a dll, maybe the namespace not insight dll. Can I check that?
There are two separate issues to be considered in using a routine that is exported from a DLL. Mixing the two issues and attempting to solve a problem by throwing in USE statements, whether those are needed or not, is not a good strategy.
If the implicit interface to the exported routine happens to be correct, you just have to make sure that the decorated name and calling conventions are matched between caller and callee when you link. If the implicit interface is not correct, Fortran requires that you provide an explicit interface to the routine at compile time. This may be done by providing an interface block or by adding a USE statement that names a module where the interface is provided.
I must confess, Olaf, that I find your error descriptions to be quite vague and lacking many important details that are required before someone can recommend how to overcome a problem. In #4, you say " it works" and, in #5, "This didn't work" and, in both cases, the reader is left wondering what "it" and "works" were supposed to mean.