bugGNU Octave - Bugs: bug #39058, Unexpected behavior from...

 
 

bug #39058: Unexpected behavior from mexPutVariable

Submitter:  None
Submitted:  Thu 23 May 2013 10:21:50 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Fixed Assigned to:  None
Originator Name:  Kory Donati Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.4
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 31 May 2013 02:50:40 PM UTC, comment #1: 

I checked in the following change on the default branch.  I don't expect that there will be another 3.6.x release, so to get this fix you'll need to either wait for the next major release of Octave (either 3.8 or 4.0) or build the development version of Octave from sources.

http://hg.savannah.gnu.org/hgweb/octave/rev/08f0f274de36

John W. Eaton <jwe>
Group administrator
Thu 23 May 2013 10:21:50 PM UTC, original submission:  

I think the mex function mexPutVariable is not working correctly, specifically when the desired workspace is set to "caller" and the mex file is called from within a function. If an mxArray is passed to the "caller" workspace from mexPutVariable, it is actually passed to one level above the caller.

In the attached example, the mex source file simple_array.c creates an array to pass to the caller's workspace. If compiled using: "mkoctfile --mex simple_array.c" and executed: "simple_array" from the command line, the variable out_caller appears in the workspace as expected, verified using "whos".

However, if the mex file is called within a m-file function(see run_me.m), then the variable is not pased to the caller, but to the base workspace. This can be seen in the attached run_me.m file. I expect to see the who list called in run_me.m to return OUT_caller.

command line calls in order:
mkoctfile --mex simple_array.c
run_me
%whos output shows nothin in run_me workspace.
whos
%output from comand line shows variable out_caller

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #28152:  simple_array.c added by None (670B - application/octet-stream)
file #28153:  run_me.m added by None (59B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by None (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 group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-05-31 jwe SummaryUnecpected behavior from mexPutVariable Unexpected behavior from mexPutVariable
    2013-05-31 jwe StatusNone Fixed
        Open/ClosedOpen Closed
    2013-05-23 None Attached File- Added simple_array.c, #28152
        Attached File- Added run_me.m, #28153

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code