Re: FORTRAN DLLs in VB 2005

etcheverryj@xxxxxxxxx wrote:
Ok so here's my problem. I'm creating a program to size parts in a
centrifugal compressor, and the majority of the program is coming from
an existing FORTRAN program. I'm actually an engineer who's beend told
to learn to program, and I'm trying to figure out how to use the
FORTRAN code as a dll to be used with visual basic code. I've been
practicing with very simple code and I'm running into an error that I
have not been able to fix.

You're going to have to step back a bit and realize that Fortran
doesn't understand VB strings (or objects) and VB has no clue what to
do with the character result of a Fortran function.

For a worked example of VB calling Fortran passing strings, see
While this was done in Intel Visual Fortran, the concepts should be
similar with other Windows Fortran compilers. This example doesn't
pass a string back, though. For a more complex example that reads and
writes VB's BSTR structures, see the MixedLanguage/VB.NET-Safearrays
sample at



Relevant Pages

  • Re: F77/C integration : strings
    ... the standard header for malloc is. ... pointer *value* to getString, which then stores the pointer to ... If you mean to treat this as CHARACTER*9 in Fortran you only need to ... Only if you want "hybrid" strings that have the padded value ...
  • Re: Passing User Defined Types from VB to Fortran
    ... new front end using VB and have the VB code call the Fortran entry ... arrays of UDTs only - unable to figure out how to handle a large volume ... UDT with included strings and arrays. ...
  • Re: read(5,*) problem?
    ... >> I can see no reason that your faith in Fortran should be shaken thereby. ... (I presume that you also don't want it interpreted as a divide in I/O ... The spaces are also lot allowed in undelimited strings. ... no deficiencies and the other way is to make it so complicated ...
  • Re: Fortran/C string interop?
    ... C strings than Fortran character strings are. ... actually arrays of the C type char that have a C null character in them to indicate the last valid element. ...
  • Re: Scan function to break up string
    ... arbitrary-length strings in Fortran90/95. ... conversions for ordinary Fortran strings. ... since Fortran2003 contains allocatable character strings. ... "ISO_VARYING_STRING was removed from the Fortran standard. ...