help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible issue in Octave when using C++ exceptions in MEX functions


From: Arnaud BARRE
Subject: Re: Possible issue in Octave when using C++ exceptions in MEX functions
Date: Thu, 11 Aug 2011 08:39:35 +0200

All my apologies... I think I found the problem which is related to
the standard output and error redirection (btk::MEXStreambufToPrintf
and btk::MEXStreambufToWarnMsgTx)...

In the code of the function, my logic was that the command
'mexErrMsgTxt' throws an error in the console but continue the execute
the code. That's why, the buffers for the standard output and error
redirection are only reset after the the try/catch block and not
directly inside.

I tested it  under MacOS X 10.5.8 and it works. I have to check under
Windows and Linux, but I think my problem is resolved.

I don't know why this problem never occured under Matlab. Maybe
because it resets the buffers directly in the 'mexErrMsgTxt' command
using their own buffers. Or the behavior is not the same at all.

Sorry for the noise.

Arnaud.

On Thu, Aug 11, 2011 at 8:13 AM, Arnaud BARRE <address@hidden> wrote:
> Hi,
>
> I developed a toolbox in biomechanics (BTK: Biomechanical ToolKit -
> b-tk.googlecode.com) for Matlab using MEX functions. One user proposed
> me to patch the code to be able to compile these MEX functions for
> Octave. It was done without any problem and the functions works well.
> However, few of these functions throw C++ exceptions (managed
> correctly by a try/catch) and Octave doesn't like them.
>
> For example, under MacOS X (10.5., using the latest binary provided by
> Octave-Forge: Octave 3.4.0), the error message is not displayed (It is
> like everything was right) and Octave freezed. The other command are
> no more executed and I have to kill the process.
>
> Under Windows (Octave 3.2.4), the problem is different. I can see the
> error message, continue to execute commands, but when I close Octave,
> it crashes.
>
> You can see the code for one MEX function using a try/catch for C++
> exceptions here:
> http://code.google.com/p/b-tk/source/browse/BTK/trunk/Wrapping/Matlab/btkReadAcquisition.cpp
>
> This function works without any problem under Matlab (Windows, MacOS X
> and Linux).
>
> Thank you very much.
>
> Arnaud
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]