- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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 kopiert
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
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??

- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite