Type marshalling to call a fortran subroutine from C#

后端 未结 2 1834
忘了有多久
忘了有多久 2021-01-23 01:36

I\'m trying to call a FORTRAN77 subroutine from C# code using P/invoke - in case you\'re interested, I\'m trying to wrap some of the functionality offered by the ARPACK library

2条回答
  •  有刺的猬
    2021-01-23 01:58

    1) Quoting Wikipedia:

    Single precision, called "float" in the C language family, and "real" or "real*4" in Fortran. This is a binary format that occupies 32 bits (4 bytes) and its significand has a precision of 24 bits (about 7 decimal digits).

    So marshal it as a float. You could have tested that one, it's either a float or a double.

    2) Quoting this Fortran 77 Tutorial:

    Fortran 77 uses the so-called call-by-reference paradigm. This means that instead of just passing the values of the function/subroutine arguments (call-by-value), the memory address of the arguments (pointers) are passed instead.

    Pass every parameter by reference.

提交回复
热议问题