Skip to main content
10-Marble
April 12, 2024
Solved

MATHCAD User-defined functions in FORTRAN

  • April 12, 2024
  • 1 reply
  • 3274 views

Good evening.

I am trying to use user-defined FORTRAN functions in MATHCAD PRIME 10. Unfortunately I do not have the Compaq compiler mentioned in the online help. Does anyone know if other compiler such as Intel OneAPI can be used and if the procedure is the same as described in the online help? My concern is about the libraries that MATHCAD PRIME needs that are Compaq proprietary and the compiler is no longer on the market. Thanks.

Best answer by terryhendicott

Hi,

The help states:-

"Creating New Custom Functions

The process of creating user custom functions involves the following steps:
Writing the source code in C or C++ (or wrapping Fortran code in a C wrapper).
About Using Fortran in Your Custom Functions
You can wrap compiled Fortran code in C or C++, allowing PTC Mathcad to run it. In this way, legacy Fortran code can be reused as a PTC Mathcad Prime function
 
This means you can use any fortran compiler that can have its code wrapped in C or C++ will work
 
Cheers
Terry
 

1 reply

21-Topaz II
April 13, 2024

Hi,

The help states:-

"Creating New Custom Functions

The process of creating user custom functions involves the following steps:
Writing the source code in C or C++ (or wrapping Fortran code in a C wrapper).
About Using Fortran in Your Custom Functions
You can wrap compiled Fortran code in C or C++, allowing PTC Mathcad to run it. In this way, legacy Fortran code can be reused as a PTC Mathcad Prime function
 
This means you can use any fortran compiler that can have its code wrapped in C or C++ will work
 
Cheers
Terry
 
gianfry10-MarbleAuthor
10-Marble
April 15, 2024

Thank you Terry for the answer.

I tried  your hint and after some tests I was able to do it.

To be honest I was stuck because of the information in the MATHCAD PRIME online help, also mentioning the FORTRAN libraries.

 

I wanted to create an exportable fortran library as DLL, but the C++ code wrapping the FORTRAN one is a better idea.

Regards,

Gianfranco

 

5-Regular Member
April 17, 2024

Hi Gianfranco, could you give an example of the implementation? Best regards, Peter