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

String to vb6

billaustralia
Beginner
786 Views
I see from the manual that if I do not include the string length in a call from vb6 to cvf, the string must be the same length in both languages eg
cvf
subroutine test(strng)
character strng*1024

vb6
strng as string * 1024
call test(strng)

But I find it works ok if I just use a normal string in vb6
strng as string

If the vb6 string is longer, then it is trucated in cvf. If the cvf string is longer, then it is padded out with nulls - at least for the cases I have looked at.

My question is; will it always be padded with nulls; or am I just picking up undefined locations which happen to be nulls?

You ask why do this? Well I produce a dll for use by writers of Excel macros, and would like to make use as simple as possible.
0 Kudos
3 Replies
Jugoslav_Dujic
Valued Contributor II
786 Views
My question is; will it always be padded with nulls; or am I just picking up undefined locations which happen to be nulls?

I'm affraid the latter is the case. However, isn't it more flexible to pass the real string length as a separate argument? This is a bit more effort to Excel colleagues but at least bulletproof.

For strings that are INTENT(IN) in nature, you don't really have to know the length -- see this recent thread on how to declare a string of "right" length.

I think this MSDN article hits the nail.

Jugoslav

Message Edited by intel.software.network.support on 12-09-2005 01:37 PM

0 Kudos
rahzan
New Contributor I
786 Views
The MSDN link is dead.
Can you respecify.

TX
Tim
0 Kudos
Jugoslav_Dujic
Valued Contributor II
786 Views
I could swear it worked for me yesterday (but it doesn't today, it's Microsoft site ;-) )... try this form.

Jugoslav
0 Kudos
Reply