Strings to Fortran dlls and back again! 
Author Message
 Strings to Fortran dlls and back again!

Please
Has anyone called a fortran dll (generated with the MS Fortran Powerstation
4.0 ) with the hope of passing a string of variable length, have the dll
process it, and return a set of strings where the number of strings can
vary.  It is not critical that  the strings be of variable length as they
can be padded, but it is necessary to return a variable number of strings
from the dll.  This is a problem that has bugged me for a while.  By
following the example in the Fortran Manual I have the following that does
not work.  I get a bad dll calling convention.   Appears simple enough but
for the life of me I can't figure it....

MY VB CODE:

Public Sub RunBatch(control As control, CharNumb As Long, LineNumb As Long)

Dim bstring As String * 40 ' Fixed-length string

'Run the thing
Call TESTR(bstring)

End Sub

My declaration is:
Public Declare Sub TESTR Lib "c:\dlls\teststring\debug\teststring.dll"
(ByVal bstring As String)

MY FORTRAN CODE:

        SUBROUTINE TESTR(bstring)
C        
          !MS$ATTRIBUTES DLLEXPORT :: TESTR
          !MS$ATTRIBUTES ALIAS  :'TESTR' :: TESTR
C      
      CHARACTER(40) bstring
        bstring = 'Hello, Visual Basic!'
      END

Any suggestions much appreciated:

Please reply to

David Bates

Department of Economics
University of British Columbia
Vancouver
Canada



Mon, 22 Mar 1999 03:00:00 GMT  
 Strings to Fortran dlls and back again!

Please
Has anyone called a fortran dll (generated with the MS Fortran Powerstation
4.0 ) with the hope of passing a string of variable length, have the dll
process it, and return a set of strings where the number of strings can
vary.  It is not critical that  the strings be of variable length as they
can be padded, but it is necessary to return a variable number of strings
from the dll.  This is a problem that has bugged me for a while.  By
following the example in the Fortran Manual I have the following that does
not work.  I get a bad dll calling convention.   Appears simple enough but
for the life of me I can't figure it....

MY VB CODE:

Public Sub RunBatch(control As control, CharNumb As Long, LineNumb As Long)

Dim bstring As String * 40 ' Fixed-length string

'Run the thing
Call TESTR(bstring)

End Sub

My declaration is:
Public Declare Sub TESTR Lib "c:\dlls\teststring\debug\teststring.dll"
(ByVal bstring As String)

MY FORTRAN CODE:

        SUBROUTINE TESTR(bstring)
C        
          !MS$ATTRIBUTES DLLEXPORT :: TESTR
          !MS$ATTRIBUTES ALIAS  :'TESTR' :: TESTR
C      
      CHARACTER(40) bstring
        bstring = 'Hello, Visual Basic!'
      END

Any suggestions much appreciated:

Please reply to

David Bates

Department of Economics
University of British Columbia
Vancouver
Canada



Mon, 22 Mar 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. call-back functions in a fortran dll

2. HELP: Structures to Strings and back again....

3. Copying from a userdefined type to a string and back again

4. Picturebox to string and back again

5. Convert SID to a string and back again

6. Passing string Arrays from Fortran DLL to Visual Basic

7. Calling FORTRAN in DLL fails with strings

8. Passing VB strings to Lahey FORTRAN DLLs

9. String arguments between VB and a Fortran DLL (VB4-32/Powerstation 4.0/Win 95)

10. String & FORTRAN DLL

11. String arguments between VB and a Fortran DLL (VB4-32/Powerstation 4.0/Win 95)

12. Passing strings back to VB from Visual C++ DLL

 

 
Powered by phpBB® Forum Software