Check the grubby details-- some fortran compilers can pass the length as a separate parameter, just after the string parameter, so you can receive them in C with void callfromfortran( char * Str, int Len )
Main Topics
Browse All TopicsThere is a fairly standard calling convention for fortran, and it's documented out on the web moderately well. Variables in general are passed by reference in FORTRAN. The problem is that no one states how strings are terminated.
I tried:
call myRoutine('xyz', 'abc')
in FORTRNA, and it calls:
void myroutine_(const char*a, const char* b) {
}
The problem is to identify the end of the strings, which is not obvious. They run into one another, not being null terminated.
As a temporary hack, I can write in my fortran:
call myRoutine('xyz\0', 'abc\0')
I don't believe \0 in FORTRAN is standard, and in any case, this is ugly.
Clearly, there is a way to get the size of the string. Identify it, and get the full 500 points, but no wild guesses please. You either know the answer, or you don't.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: jkrPosted on 2006-08-23 at 13:33:28ID: 17375997
I know this is "enemy territory", but MS has some info about that: http://msdn.microsoft.com/ library/en -us/vccore 98/html/ _c ore_charac ter_string s.asp ("Handling Data Types in Multiple Languages - Character Strings"). Yet I am not sure if that is standard F77. Just remembered having read about that a while ago.