bugGNU Octave - Bugs: bug #51585, mex.h not compatible with Matlab...

 
 

bug #51585: mex.h not compatible with Matlab implementation

Submitted by:  None
Submitted on:  Wed 26 Jul 2017 02:53:21 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Matlab Compatibility
Status: InvalidAssigned to: None
Originator Name: vitoOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 4.2.1
Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 27 Jul 2017 11:17:11 PM UTC, comment #3:

Great, glad it worked out. Closing report.

Rik <rik5>
Project Administrator
Thu 27 Jul 2017 06:40:42 PM UTC, comment #2:

You are correct, latest Matlab does not seem to need extern &quot;C&quot; on mex.h anymore.

We'll update Matlab to latest version on our side. This means that this bug can be probably closed unless people need to interoperate with older versions. Thanks for the help!

Anonymous
Wed 26 Jul 2017 11:57:00 PM UTC, comment #1:

Which version of Matlab are you using? Current versions do not seem to require the extern declaration. I'm basing that on some help text that I could find online (https://www.mathworks.com/help/matlab/matlab_external/compiling-c-mex-files-with-mingw.html). This Stack Overflow article also looked useful (https://stackoverflow.com/questions/35134314/mex-function-unresolved-external). In the resolution, the author doesn't need to use extern declarations at all, but interestingly you have to worry about file naming conventions a lot.

If you look at the implementation of mex.h that Octave uses, it automatically accomodates compilation with either C or C++. See these lines:

I would think that Matlab does something similar now.

Rik <rik5>
Project Administrator
Wed 26 Jul 2017 02:53:21 PM UTC, original submission:

Matlab mex.h requires extern "C" when included from C++. Octave mex.h fails to build if it is wrapped in extern "C" with templates.

Simple example (main.cpp):

Compile:

Removing extern "C" around mex.h include fixes the problem, however it breaks the build on Matlab.

This was tested on Linux with Octave 4.2.1.

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 27 Jul 2017 11:17:11 PM UTCrik5StatusNeed Info=>Invalid
      Open/ClosedOpen=>Closed
    Wed 26 Jul 2017 11:57:21 PM UTCrik5StatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1