Re: use a c dll in fortran?



tripplowe@xxxxxxxxx wrote:
Hey Folks,

Is it possible to use a dll created in C in my Fortran programs (Lahey
Fortran 95). If so, could you point me towards some documentation on
how it can be done? Google searches return a lot of "use fortran dll
in c" or "fortran dll in vb", but I can not seem to find "use c dll in
fortran".

Thanks Much.
R. Lowe

You may benefit by thinking about DLLs not a C DLLs or Fortran DLLs but DLLs with certain linkage conventions (Optlink, Stdcall, cDecl, etc.).

Many compilers, C as well as Fortran, accept switches as well as modifiers in the code, directing them to produce code following these linkage conventions. You then see if compiler X can output code using the linkage Y that your DLL Z was built with.

If not, you try to obtain the source code for DLL Z and recompile the DLL using a linkage convention common to the two or more compilers that you use.

If this also fails, you consider writing wrapper code or assembler glue code.

N. Shamsundar
University of Houston
.



Relevant Pages

  • Re: Look at this before considering to use Intel Visual FORTRAN
    ... > FORTRAN is definitely not the first choice. ... > workaround by writing a COM-Wrapper in DVF, so the DLL runs in the DVF ... > Intel Customer Support ...
    (comp.lang.fortran)
  • Re: exporting functions/subs from fortran?
    ... It's nice to hear other developers with your caliber exist. ... Yes I did dismiss the other options regarding the DLL development (in-proc, ... >> but this project is all FORTRAN and I figured this would be a good place ... >> the fact that I'm calling code in an exe from another exe and the first ...
    (comp.lang.fortran)
  • Re: Threading and DllImport
    ... DLL has already been loaded. ... various unpredictable errors from within the FORTRAN code, ... I don't know anything about "Intel Thread-Checker". ... were able to reproduce the problem in a simple example. ...
    (microsoft.public.dotnet.framework)
  • Re: DLL Problem Laufzeitfehler RTL (Manifest?)
    ... Benutzerschnittstellen zu FORTRAN bereitstellt. ... Da ich aber mit C++ arbeite habe ich eine DLL mit MS Visual C++ geschrieben die von einem sehr kleinen FORTRAN Programm aufgerufen bzw. genutzt wird. ... In de alten Version mit ABAQUS 6.4 und MS Visual Studio 2003 sowie dem Intel FORTRAN Compiler 6.5 funktionierte das auch wunderbar. ...
    (microsoft.public.de.vc)
  • Re: Problems when calling functions from a .dll
    ... > I have quite some problems with calling functions from a .dll. ... originally written in Fortran and compiled by ... > PRECISION (double in Matlab); ... > as a basic for my header file, which is based on the example file ...
    (comp.soft-sys.matlab)