I used to use NETLink to call FORTRAN functions or subroutines compiled into a dll file. This works very well until now that I want to call a function which has complex arguments and returns a complex number.

I checked the NETLink user guide. It says that the .NET complex type is controlled by the user, and gives an example in c#. Does anybody know how this can be realized for FORTRAN? I am looking forward to great answers and suggestions.

Many thanks.

  • $\begingroup$ a simple minded approach would be to have the fortran take separate real and imaginary parts and combine them with cmplx $\endgroup$ – george2079 May 26 '17 at 15:34
  • $\begingroup$ thanks for the suggestion. This I know, but this would require a lot of wrapping since my fortran code contains many functions and subroutines with complex numbers... Is there any other possible method? $\endgroup$ – unstable May 27 '17 at 2:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.