- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can I call the following Fortran subroutine:
subroutine runcmd(command)
character*256 command
...
Do something ....
...
return
end
from C++ (VC++ 6)
When calling it like this:
extern "C" { void __stdcall RUNCMD(char* command); }
RUNCMD("This is at test");
I get the following compiler error message:
unresolved external Symbol _RUNCMD@4
I now that it has something to do with a hidden length argument,
passed with characters, but don't know what's to do.
Thanks in advance
subroutine runcmd(command)
character*256 command
...
Do something ....
...
return
end
from C++ (VC++ 6)
When calling it like this:
extern "C" { void __stdcall RUNCMD(char* command); }
RUNCMD("This is at test");
I get the following compiler error message:
unresolved external Symbol _RUNCMD@4
I now that it has something to do with a hidden length argument,
passed with characters, but don't know what's to do.
Thanks in advance
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, hidden length argument is passed (by default, immediately after string argument.) You should either add and additional length argument in C declaration:
or adjust the Fortran routine so that it doesn't expect length:
HTH
Jugoslav
extern "C" { void __stdcall RUNCMD(char* command, int len); }
or adjust the Fortran routine so that it doesn't expect length:
subroutine runcmd(command) !DEC$ATTRIBUTES REFERENCE:: command character*256 command
HTH
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page