bugGNU Octave - Bugs: bug #64897, OCTAVE_QUIT macro no longer works...


bug #64897: OCTAVE_QUIT macro no longer works in C MEX file

Submitter:  Sébastien Villemot <svillemot>
Submitted:  Wed 15 Nov 2023 04:52:18 PM UTC
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  9.1.0 (current stable) Planned Release:  9.1.0 (current stable)
* Mandatory Fields

Add a New Comment Rich Markup

Wed 22 Nov 2023 01:07:18 PM UTC, comment #5: 

Thanks for testing.

Closing as fixed.

Markus Mützel <mmuetzel>
Group administrator
Wed 22 Nov 2023 10:15:22 AM UTC, comment #4: 

Thanks, I confirm that your commit fixes the issue for me.

Sébastien Villemot <svillemot>
Tue 21 Nov 2023 05:11:28 PM UTC, comment #3: 

Good point!

With that changed the original example works for me (on Windows):

Marking as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Tue 21 Nov 2023 11:31:10 AM UTC, comment #2: 

Thanks. It still does not work. I think this is because you did not enclose the new symbol within an extern "C" block, hence its name goes through C++ mangling.

Sébastien Villemot <svillemot>
Thu 16 Nov 2023 02:00:32 PM UTC, comment #1: 

Thank you for the report

IIUC, OCTAVE_QUIT probably doesn't work in any C code currently.
Does the following change work for you (completely untested so far):

diff -r b5e433b52bc3 liboctave/util/quit.cc
--- a/liboctave/util/quit.cc        Mon Nov 13 16:58:52 2023 +0100
+++ b/liboctave/util/quit.cc        Thu Nov 16 14:46:53 2023 +0100
@@ -96,13 +96,13 @@

-void octave_quit_c (void)
+OCTAVE_API void octave_quit_c (void)
   octave_quit ();

 octave_handle_signal ()

Markus Mützel <mmuetzel>
Group administrator
Wed 15 Nov 2023 04:52:18 PM UTC, original submission:  

Consider the following C MEX file:

#include <mex.h>
#include <octave/quit.h>

mexFunction(int nlhs, mxArray *plhs[],
            int nrhs, const mxArray *prhs[])

It is compiled with Octave 9 (hg ID b5e433b52bc3) using the following command:

mkoctfile -mex helloworld.c

Then the MEX fails to load under Octave 9:

$ octave
GNU Octave, version 9.0.0
octave:1> helloworld
error: /tmp/helloworld.mex: failed to load
Incompatible version or missing dependency?
/tmp/helloworld.mex: undefined symbol: octave_quit_c

I don’t know to which extent this is supported, but at least it used to work for Octave 8.

I guess the octave_quit_c symbol is not exported in liboctave. The changeset that triggers this issue seems to be 5f0b8101234e.


Sébastien Villemot <svillemot>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by svillemot (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.


    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-11-22 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 9.1.0 (current stable)
    2023-11-21 mmuetzel StatusNone Ready For Test
        Operating SystemGNU/Linux Any
    2023-11-16 mmuetzel Planned ReleaseNone 9.1.0 (current stable)

    Back to the top

    Powered by Savane 3.12