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

Passing a string from fortran to visual basic library

manuel_castro
Beginner
922 Views

Dear All,

I would be really thankful if you could help me with this:

I would like to pass a string parameter to a routine in a library (source code not available) designed for a use in visual basic. The way that it is declared for use in visual basic is as follows:

Declare Function XPRMloadmod Lib "xprm_rt" Alias "_XPRMloadmod@8" (ByVal bname As String, ByVal intname As String) As Long

I am interested in an equivalent fortran interface declaration section as I would like to use the previous function in fortran.

Basically I do not know how to form a visual basic string in fortran.

Many thanks,

Manuel.

0 Kudos
1 Reply
Steven_L_Intel1
Employee
922 Views

Something like this:

fumction XPRMloadmod (bname, intname)
integer XPRMloadmod
!DEC$ ATTRIBUTES STDCALL, REFERENCE, DECORATE, ALIAS:"XPRMloadmod" :: XPRMloadmod
character(1024) bname
!DEC$ ATTRIBUTES REFERENCE :: bname
character(1024) intname
!DEC$ ATTRIBUTES REFERENCE :: intname

You will need somehow to determine the lengths of the strings. I haven't looked, but it might be that VB appends a NUL like C does, so you can do something like:

len_bname = index(bname,char(0)) - 1
len_intname = index(intname,char(0)) - 1

0 Kudos
Reply