- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to pass an array of strings from VB, to a DVF dll. Currently, I have followed the mixed language example that comes with the software (DF98samplesmixlangvbarraysarrays.f90) and it works fine. However, this example passes only one argument, the string array. When I try to add additional arguments to the argument list, I get an "out of stack space" or "bad dll calling convention" error.
What is the cause of this and how is it possible to add additional arguments to the list without tripping these errors? My guess is that it is in either the VB declaration, or in the DVF, !DEC$ parameters in the fortran code. I've tried numerous permutations and variations but can't seem to get it to work.
To replicate this error, take the arrays.f90 code cited above, and add a Long Integer N, to the argument list just after 'VBArray' in the dll, and just after 'mystring' in the VB declaration and the VB code.
What is the cause of this and how is it possible to add additional arguments to the list without tripping these errors? My guess is that it is in either the VB declaration, or in the DVF, !DEC$ parameters in the fortran code. I've tried numerous permutations and variations but can't seem to get it to work.
To replicate this error, take the arrays.f90 code cited above, and add a Long Integer N, to the argument list just after 'VBArray' in the dll, and just after 'mystring' in the VB declaration and the VB code.
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is an example pulled out from our f90VB User manual (I made some minor modifications):
In the subroutine body you would need to call the appropriate Windows APIs to handle the Safe Arrays and their BStrings.
On the visual basic side, you would declare this sub as:
Best regards,
Marco A. Garcia
Canaima Software, Inc.
http://www.canaimasoft.com
Developers of f90SQL the Database Connectivity Solution for Fortran, and f90VB the Library for Fortran-OLE Automation and Fortran-VB Programming
subroutine BBStrSort(USAHndl, SSAHndl, CaseSensitive, iError)
!This subroutine uses the bubble sort algorithm
!to sort a vector of strings (USAHndl). The
!sorted vector is returned in SSAHndl
!DEC$ATTRIBUTES STDCALL:: BBStrSort
!DEC$ATTRIBUTES DLLEXPORT:: BBStrSort
!DEC$ATTRIBUTES ALIAS: 'BBStrSort':: BBStrSort
!DEC$ATTRIBUTES REFERENCE:: USAHndl, SSAHndl, CaseSensitive, iError
implicit none
!Subroutine arguments
integer(4),intent(in)::USAHndl
integer(4),intent(inout)::SSAHndl
integer(2),intent(in)::CaseSensitive
integer(2),intent(inout)::iError
? (subroutine body goes here)
end subroutine BBStrSort
In the subroutine body you would need to call the appropriate Windows APIs to handle the Safe Arrays and their BStrings.
On the visual basic side, you would declare this sub as:
Declare Sub BBStrSort Lib "Example52.dll" (UStrArray() As String, SStrArray() As String, CaseSensitive As Boolean, iError As Integer)
Best regards,
Marco A. Garcia
Canaima Software, Inc.
http://www.canaimasoft.com
Developers of f90SQL the Database Connectivity Solution for Fortran, and f90VB the Library for Fortran-OLE Automation and Fortran-VB Programming
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
What's up with the newgroup software? When you post a message, the preview shows one format, when the message is posted, it comes out with all newlines removed. Is there a way around this problem?. The forum's help doesn't seem to help here....
Marco Garcia
Canaima Software
What's up with the newgroup software? When you post a message, the preview shows one format, when the message is posted, it comes out with all newlines removed. Is there a way around this problem?. The forum's help doesn't seem to help here....
Marco Garcia
Canaima Software
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Marco,
That's the way it works, unfortunately. Bracket your code with
We're investigating an alternate message board solution that should be a lot better in these areas. Sorry for the inconvenience.
I will edit your post appropriately.
Steve
That's the way it works, unfortunately. Bracket your code with
...
and it will be (mostly!) left alone. If you have any angle brackets in the text, use < and > instead.We're investigating an alternate message board solution that should be a lot better in these areas. Sorry for the inconvenience.
I will edit your post appropriately.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm certainly not an expert at this, but the postings accept certain HTML tags. The tags are necessary to properly format certain items, like code postings. The pre and /pre tags and others should work for this.
Mike Durisin
Mike Durisin

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page