Re: MSPF/CVF/CVF DLL calling a LF90/LF95 DLL?

From: Richard Maine (nospam_at_see.signature)
Date: 12/18/03


Date: Thu, 18 Dec 2003 13:36:57 -0800

Catherine Rees Lay <spamtrap@polyhedron.org.uk> writes:

> Remember that a DLL doesn't know what called it. It just gets
> information, which it blithely assumes has been sent using the calling
> conventions etc. it understands. There's no such thing as a DLL which
> only works from C, or from Fortran, or whatever. If you can get it the
> right information in the right format, it will never know what
> language you are using. Conversely, send it using cdecl instead of
> stdcall and you won't get a nice friendly error message saying "excuse
> me, you're not using my calling convention", you'll get a crash or
> junk results.

which sounds an awful lot like "good" old f77-style external procedures.
Discrepancies between the caller and callee were among the most common
sources of errors in f77 codes and were occasionally very tricky to
debug. Some of the nastiest debugging experiences I've ever had were
related to this, with symptoms that didn't show up until far later in
far-removed parts of the program. This is still a pretty common source
of bugs in code that this newsgroup is asked for help with.

Those of us who put essentially all our procedures in modules don't
much have this problem any more. I don't recall the last time that
I had this class of error in my own Fortran code - it has been a
*LONG* time. (Though I "cheated" by adding the word Fortran in that
sentence, which allows me to exclude problems relating to interfacing
between Fortran and C codes; I've certainly had argument mismatch
problems there a lot more recently than I have had in any purely Fortran
parts of my codes).

Of course, we've recently been assured both that dlls solve all of the
world's problems and that f90 features like modules don't have
anything useful to offer. So I'm obviously pretty out of touch with
things. :-(

-- 
Richard Maine                       |  Good judgment comes from experience;
email: my first.last at org.domain  |  experience comes from bad judgment.
org: nasa, domain: gov              |        -- Mark Twain


Relevant Pages

  • Re: thoughts on dynamic from a beginners perspective
    ... working engineering and heavy duty numerical codes from Fortran to ... writing such codes today. ... Interoperating between managed languages makes it trivial to ...
    (comp.programming)
  • Re: C++/Fortran mixing
    ... >> rather big Fortran code which compiles and links fine under ifc. ... The only current standard conforming way to do this is via Ada. ... defines conventions to "link" with Fortran 77 and C89, so you can, in principle ... have an Ada compiler available ...
    (comp.lang.fortran)
  • Re: C++/Fortran mixing
    ... >> rather big Fortran code which compiles and links fine under ifc. ... The only current standard conforming way to do this is via Ada. ... defines conventions to "link" with Fortran 77 and C89, so you can, in principle ... have an Ada compiler available ...
    (comp.lang.cpp)
  • Re: declarations summary
    ... Well, many scientists and engineers don't have the time, motivation or ... ability to master the intricacies of recent fortran vintages either. ... Toy codes will probably move from Matlab to Python soon enough, ...
    (comp.lang.python)
  • Calling Intel Visual Fortran from Python
    ... I have been exploring calling Fortran DLL subroutines from Python. ... thing can be done on at the level of a subroutine, ...
    (comp.lang.fortran)

Loading