Mixed language problem Fortran calling C++

Mixed language problem Fortran calling C++

I am a complete novice as far as C++ is concerned, so having great difficulty with interfacing my Fortran and C++ codes:

On the Fortran side:

 INTERFACE
    SUBROUTINE HASHSTRING (str_in, str_in_len, str_out, str_out_len, Status) BIND(C)
    USE,INTRINSIC :: ISO_C_BINDING  ! Declares C kinds
    USE IFWIN, ONLY : DWORD

    CHARACTER(KIND=C_CHAR),DIMENSION(*) :: str_in,str_out
    INTEGER(C_INT), VALUE, INTENT(IN) :: str_in_len, str_out_len
    INTEGER(DWORD), INTENT(INOUT) :: Status
    END SUBROUTINE HASHSTRING
END INTERFACE

On the C++

extern "C" void hashstring (
    char* MyString,
    int MyStringLen,
    char* encHash,
    int encHasHLen,
    DWORD dwStatus)

Everything is working except returning the Status.  Even though when in debug mode, this has a value of 0 in the cpp routine, when I get back to Fortran, it has the value it had before the call.

SOLVED it myself -- needed & on the dwStatus argument.

Thanks,

David

1 条帖子 / 0 全新
如需更全面地了解编译器优化,请参阅优化注意事项