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.
Solved! Go to Solution.
Hi,
The help states:-
"Creating New Custom Functions
Hi,
The help states:-
"Creating New Custom Functions
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
Hi Gianfranco, could you give an example of the implementation? Best regards, Peter
I will Peter.
I am debugging the implementation at the moment, so it can be used by my colleagues at work and I will publish here as well to help other friends.
Kindest regards,
Gianfranco
Good evening, Peter.
Just to start, I would recommend to follow the PRIME help online (F1) where you can find some initial information on how to compile some user-defined functions in C language. The examples are found in your PRIME installation folder under the subfolder Custom Functions.
The first thing I did is to try compile and use the examples provided and get familiar with the code and how it works. Compiling the given example, will tell you that your compiler is set-up correctly and that the *.DLL file is recognized and works with MATHCAD PRIME.
Once the above is done, then it is time to implement the FORTRAN wrapper by writing the example user-defined functions in FORTRAN, compiling them in a static library. And this is the easy part.
Once the static library *.lib is created, then we need again to use C language and here the MATHCAD online help becomes unclear to say least.
The C code to be modified should look like the one below:
When I tried I got several errors I am fixing. Moreover the help online indicates FORTRAN runtime libraries which are valid for and old compiler. The current one from INTEL is different and when I checked for mixed-language C/FORTRAN the C codes are not comparable from the examples given in the help online.
Long story short...and lesson learnt...
I thought it might work straight, but I was wrong. So please be patient for the timing you will receive a fully working solution that will work probably only using the OneAPI free compilers (FORTRAN and C/C++).
Meantime I wish you a nice weekend...
...and. Stay tuned.
Regards,
Gianfranco
Thank you, Gianfranco! I will check the documentation. Looking forward to you post. Have a nice weekend, Peter