hidden length arguments vs 'varying' attribute

hidden length arguments vs 'varying' attribute

I have a case where Fortran calls a C function with string arguments, and the 'C' function's interface contains the 'VARYING' attribute. The fortran call presents the string arguments as '%ref (string)' so as to supress the hidden length arguments. This appears to work elsewhere, but for those arguments in the '...', varying section of arguments (which are not explicitly specified in the interface), it appears that the hidden length arguments are (unfortunately) still provided. So far the only approach I can come up with is to use the compiler switch to force all hidden length arguments to the end of the list, to be ignored by the C function.

Has anyone seen this effect? Is there another solution to avoid hidden length arguments for strings passed by reference to 'C' 'VARYING' functions?

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Unfortunately %REF does not prevent the hidden length from being passed in any case. I don't agree with this but I lost that argument. :-) Anyhow the workaround, not pretty but it works, is replace the %REF(stringvar) with %VAL(LOC(stringvar)).

James

Leave a Comment

Please sign in to add a comment. Not a member? Join today