- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to pass a string array from VB.Net to Fortran CVF DLL.
I can do it with no problem in VB6 but because of a change in VB.Net
I can seem to get it to work because VB.Net does not allow the
definition of a string to have a length.
Example:
In VB6
type stringarray
dim mystring(9) as string * 80
end type
In VB.net as far as I can tell, you CAN'T define a length.
type stringarray
dim mystring(9) as string
end type
Also, how do I pass structures with a string in it?
Is there a difference between passing a structure and
a class instance?
Thank in advance for any help!
I can do it with no problem in VB6 but because of a change in VB.Net
I can seem to get it to work because VB.Net does not allow the
definition of a string to have a length.
Example:
In VB6
type stringarray
dim mystring(9) as string * 80
end type
In VB.net as far as I can tell, you CAN'T define a length.
type stringarray
dim mystring(9) as string
end type
Also, how do I pass structures with a string in it?
Is there a difference between passing a structure and
a class instance?
Thank in advance for any help!
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The above show you how to declare fixed length strings in Visual Basic.Net
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I recently added this example of VB.NET calling CVF to the CVF web site, though it doesn't cover arrays or structures. There are discussions of VB arrays in past issues of the CVF newsletter, and, I think, in the Programmer's Guide chapter on mixed-language programming.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found out that you have to declare your dll as Ansi.
I had a programmer who declared it as "Auto" and it
gave me every other charcter in my Fortran DLL because
it assumed it was unicode data.
Ansi Optional. Converts all strings to ANSI values. If no modifier is specified, Ansi is the default.
Unicode Optional. Converts all strings to Unicode values.
Auto Optional. Converts the strings according to common language runtime rules based on the name of the method (or the alias name, if specified).
I had a programmer who declared it as "Auto" and it
gave me every other charcter in my Fortran DLL because
it assumed it was unicode data.
Ansi Optional. Converts all strings to ANSI values. If no modifier is specified, Ansi is the default.
Unicode Optional. Converts all strings to Unicode values.
Auto Optional. Converts the strings according to common language runtime rules based on the name of the method (or the alias name, if specified).

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