bugGNU Octave - Bugs: bug #40429, struct array in MEX file


bug #40429: struct array in MEX file

Submitter:  Guillaume <gyom>
Submitted:  Wed 30 Oct 2013 07:08:01 PM UTC
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  jwe
Originator Name:  Guillaume Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Thu 31 Oct 2013 07:29:40 PM UTC, comment #9: 

Sorry about the confusion with pushing the patch...

John W. Eaton <jwe>
Group administrator
Thu 31 Oct 2013 07:13:52 PM UTC, comment #8: 

It works fine for me now.
Many, many thanks for your quick help.

Guillaume <gyom>
Thu 31 Oct 2013 06:24:53 PM UTC, comment #7: 

Argh, sorry, it really is there now.

John W. Eaton <jwe>
Group administrator
Thu 31 Oct 2013 05:41:33 PM UTC, comment #6: 

I might be too impatient but I still don't see the changeset on savannah...

Guillaume <gyom>
Thu 31 Oct 2013 05:29:46 PM UTC, comment #5: 

Oops, sorry, I forgot to push the changeset.  It's on savannah now.  Could you please update and try again?

John W. Eaton <jwe>
Group administrator
Thu 31 Oct 2013 04:44:44 PM UTC, comment #4: 

My hg id is 0a887758d1cc.
That's the most recent I can see here:
(note that I am compiling in the source tree).

Guillaume <gyom>
Thu 31 Oct 2013 04:37:44 PM UTC, comment #3: 

What is your hg id?  I'm able to build with --disable-gui.  I'm currently at this changeset:

changeset:   17814:e50a3664bd45
tag:         tip
user:        John W. Eaton <jwe@octave.org>
date:        Thu Oct 31 03:58:26 2013 -0400
summary:     make compilation of main.cc work again when not building GUI

John W. Eaton <jwe>
Group administrator
Thu 31 Oct 2013 12:09:23 PM UTC, comment #2: 

Many thanks for this.

I haven't been able to test it yet as I have compilation problems with the latest version:

making main.cc from main.in.cc
g++ -DHAVE_CONFIG_H -I. -I..  -I../liboctave/array -I../liboctave/cruft/misc -I../liboctave/numeric -I../liboctave/system -I../liboctave/util -I../libinterp -I../libinterp/corefcn -I../libinterp/corefcn -I../libgnu -I../libgnu    -Wall -W -Wshadow -Wold-style-cast -Wformat -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual -g -O2 -pthread -MT octave-main.o -MD -MP -MF .deps/octave-main.Tpo -c -o octave-main.o `test -f 'main.cc' || echo './'`main.cc
main.cc: In function ‘int main(int, char**)’:
main.cc:419:11: error: ‘gui_libs’ was not declared in this scope
main.cc:432:11: error: ‘start_gui’ was not declared in this scope
main.cc:444:7: error: ‘gui_libs’ was not declared in this scope
main.cc:444:19: error: ‘start_gui’ was not declared in this scope

It is related to this:
but the changeset does not fix it for me.
I compile with --disable-gui.

Guillaume <gyom>
Wed 30 Oct 2013 11:08:10 PM UTC, comment #1: 

I checked in the following changeset:


It seems to fix the problem for me, but I'll wait for verification before closing this report.

John W. Eaton <jwe>
Group administrator
Wed 30 Oct 2013 07:08:01 PM UTC, original submission:  

I have a MEX file that works fine on MATLAB but not with Octave. I managed to minimise the code to illustrate the problem, see teststruct.c attached.

After compilation, with MATLAB:

>> teststruct(struct('t',5))
ans =
    t: 10

while with Octave:

octave> teststruct(struct('t',5))
ans =
  11508528x0 struct array containing the fields:

If any of the commented line is used instead of the dynamic allocation then it runs fine.

My apologies if the problem is with my code and not Octave but I am puzzled because of the difference of behaviour between Octave and MATLAB.

Guillaume <gyom>


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

Attach Files:

Attached Files
file #29510:  teststruct.c added by gyom (484B - text/x-csrc)


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 gyom (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-10-31 jwe StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2013-10-30 jwe Item GroupOther Incorrect Result
        StatusNone Ready For Test
        Assigned toNone jwe
    2013-10-30 gyom Attached File- Added teststruct.c, #29510

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code