A OpenVMS (VAX) FORTRAN subroutine can be passed a character*(*)
:
subroutine forsub (in)
character*(*) in
type *, in
return
end
from a C function:
#include<stdio.h>
#include <descrip.h>
extern void forsub();
main()
{
auto $DESCRIPTOR(in_string, "VMS pass from c to fortran.");
forsub(&in_string);
}
How is the OpenVMS (VAX) FORTRAN function that returns a character*(*)
:
character*(*) function forfunc (in)
character*(*) in
forfunc = in
return
end
handled in the C code:
#include<stdio.h>
#include <descrip.h>
extern ?????? forfunc();
main()
{
auto $DESCRIPTOR(in_string, "VMS fortran function return to c.");
??????? = forfunc(&in_string);
}
- OpenVMS V6.2
- Digital Fortran 77 V6.5-188
- DEC C V6.0-001
Example 3-5 in this (old?) C User's Guide probably explains how to do this: you need the already mentioned hidden argument. An example would be: