octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #51754] MEX interface returns odd NULL objects


From: Rik
Subject: [Octave-bug-tracker] [bug #51754] MEX interface returns odd NULL objects
Date: Mon, 14 Aug 2017 19:28:42 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0

URL:
  <http://savannah.gnu.org/bugs/?51754>

                 Summary: MEX interface returns odd NULL objects
                 Project: GNU Octave
            Submitted by: rik5
            Submitted on: Mon 14 Aug 2017 04:28:41 PM PDT
                Category: Libraries
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

Since this cset (http://hg.savannah.gnu.org/hgweb/octave/rev/2e4033e1f28f) the
MEX interface returns undefined objects rather than empty matrices ([]) for
unused outputs.  It is Matlab compatible that these objects be undefined,
however it causes problems back in Octave.

Example code is taken from mex_demo.c in the examples/code directory.


#include "mex.h"

void
mexFunction (int nlhs, mxArray *plhs[],
             int nrhs, const mxArray *prhs[])
{
  mexPrintf ("Hello, World!\n");

  mexPrintf ("I have %d inputs and %d outputs\n", nrhs, nlhs);

  mxArray *v = mxCreateDoubleMatrix (1, 1, mxREAL);
  double *data = mxGetPr (v);
  *data = 1.23456789;

  plhs[0] = v;
}


Compile and then run


octave:2> [a,b,c] = mex_demo (1)
Hello, World!
I have 1 inputs and 3 outputs
a =  1.2346
b =

error: octave_base_value::print (): wrong type argument '<unknown type>'


It seems like Octave might need to prune the octave_value_list that is
returned to only non-null values.






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51754>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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