- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to call a Fortran DLL from VC++.
The IVF code is something like:
module Types
type errorType
sequence
integer*4Error_Flag
character*512Error_Msg
end type errorType
end module Types
subroutine myRoutine(error)
!dec$attributes dllexport, default, stdcall, decorate, alias: 'myRoutine' :: myRoutine
!dec$attributesreference :: error
use Types
...
write(error%error_Msg,*) 'Error: in myRoutine'
return
end subroutine myRoutine
The C++ header code is something like
#ifdef __cplusplus
extern "C" {
#endif
struct errorType
{
unsigned char error_flag;
char error_msg[512];
};
void __stdcall myRoutine
(
errorType* error
);
#ifdef __cplusplus
}
#endif
The problem I have is that when I callthe FORTRAN routine the error_msg variable is correctly set but returns empty.
Can anyone offer some insight, the actually code is more complicated (additional arguments etc) but I hope I have caught the essence of it.
Thanks for your time
Cliff
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In your routine, should you not includea TYPE declaration for your argument ERROR. i.e..
TYPE (ERRORTYPE) ERROR
?
And what is an 'unsigned character' in your C++ Structure??

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