Bernard Urban wrote:
>No, I think I will need to write a C function having the same
>name as the one implementing the STOP statement,
>which returns to Lisp (problem not investigated so far),
>and link to it before dlopening libf2c.
I see two solution paths:
a) have C:STOP() set a variable, that you can query (def-c-var) upon return on your function.
b) Have C:STOP() call a callback initially set via another C:hand-written() function. That callback would signal an error.
(defun fortran-stopped ()
(def-call-out hand-written (:arguments (callback (c-function (:arguments)(:return-type void)))))
See impnotes and tests/ffi.tst for further callback examples.
BTW, what does cmucl say about the undefined STOP?
a) is much more portable across Lisps.
b) is likely to cause problems with C++ code (destructors and unwind-protect not being called...), but is good enough for C and presumably Fortran (I haven't heard of unwind-protect like construct in Fortran, but what do I know about it).
Generally, raising exceptions across language barriers is hairy.
Get latest updates about Open Source Projects, Conferences and News.