Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Strings - VB and Fortran DLLs

Phares__Cliff
Beginner
394 Views

I would like to pass strings between VB applications and Fortran DLLs.

Any help would be greatly appreciated. I'm wondering what the !DEC ATTRIBUTE statements look like and what the VB Declare statements are for these two cases. Are the conventions the same in VS2005 ?

1.

I would like to pass to a Fortran DLL:

CHARACTER(*),INTENT(IN)::strIN

2.

I would like VB app to receive a stringfrom a Fortran DLL:

CHARACTER(*),INTENT(OUT)::strOUT

INTEGER(4), INTENT(OUT):: LEN_strOUT

Again, any help is greatly appreciated,

Cliff Phares

0 Kudos
1 Reply
Steven_L_Intel1
Employee
394 Views
See the MixedLanguageVB-Calls-Fortran sample provided with 10.0. If you use CHARACTER(*), the VB code has to pass the length by value at the end of the argument list. On the VB side, you have to pass the string ByVal.

As long as you're not trying to change the length of the string, you can return a string from Fortran. If you want more, then you have to get into "BSTRINGs", as illustrated in the VB.NET-Saferarrays sample.
0 Kudos
Reply