Question: How do I call Maple from Fortran?

Fortran 2000 introduced a simple system for interoperability with C. That was expanded in 2020 to provide C macros to support Fortran concepts that do not exist in C, such as optional arguments and assumed-shape arrays. This is all described in Chapter 18 of the Fortran 2020 standard at http://j3-fortran.org/doc/year/21/21-007.pdf.

 

I want to call Maple from Fortran. The StartMaple function has a result of type MKernelVector. I can't find any description of it in the Advanced Maple Programming Guide other than that it's a handle. In order to create a Fortran variable to hold the result of StartMaple, to pass to the other functions, I need to know more. Is it an int or a long or a longlong or a pointer, or what?

 

I guessed longlong would work, but it apparently doesn't. The result value of StartMaple is nonzero and apparently at least 64 bits. Invoking EvalMapleStatement using that result value causes a segmentationf fault (I'm running Debian Buster 10 Linux).

 

That's as far as I've gotten.

 

Any ideas how to proceed?

 

Please Wait...