Menu

Hardcoded File Extensions

Help
Gunter
2014-06-02
2014-06-06
  • Gunter

    Gunter - 2014-06-02

    Hi,
    I just installed gcc and gnumex. The first tests worked quite well. Just one thing confused my code and me: I used dll as output file extension. But as you hardcoded the extension in mexopts.bat to mexw32 or mexw64, my setting was ignored. Why don't you use %MEX_EXT% there?
    Best regards,
    Gunter

     
  • Tony Kelman

    Tony Kelman - 2014-06-02

    Pretty sure we are using mexext, as indicated by Matlab. If you're using an old enough version of Matlab that mexext is dll (so, probably over a decade old now), try using an older version of Gnumex from before we put in support for 64 bit Matlab.

     
  • Gunter

    Gunter - 2014-06-03

    I am sorry, but the mexopts.bat clearly had ".mexw32" for my 32 bit Matlab 2007b (where I needed the dll extension) and ".mexw64" for my 64 bit Matlab 2014a. In an old mexopts.bat I found the %MEX_EXT% to replace that.

     
    • Richard C

      Richard C - 2014-06-03

      What Tony means, is that the extension to use when generating mex files is copied into mexopts.bat when you use gnumex to generate the mexopts.bat file. The string to put in is generated using the mexext() function in Matlab.

      At what point are you wishing to tell matlab to use the 'dll' extension for mex instead, and how exactly are you doing it?

      There does not at first glance appear to be a documented option to do this using mex.m, but I'm sure we could think about implementing it if there was a good case for it. Explaining why exactly you want to do this would help build this case.

       
    • Richard C

      Richard C - 2014-06-03

      Incidentally, .mexw32 has been the default mex extension on 32 bit windows since MATLAB 7.1 (R14SP3), (which is pre r2006).

      See:

      http://www.dynare.org/DynareWiki/MatlabVersionsCompatibility#MATLAB_7.5_.28R2007b.29

       
  • Gunter

    Gunter - 2014-06-03

    I am referring to this line in mexopts.bat:
    set NAME_OUTPUT=-o %OUTDIR%%MEX_NAME%.mexw32
    It could simply be replaced by
    set NAME_OUTPUT=-o %OUTDIR%%MEX_NAME%%MEX_EXT%

    Specifying dll as output is done in our compile script by:
    mex filename.c -output filename.dll

     
    • Richard C

      Richard C - 2014-06-03

      ok, actually this sounds like a useful change. I expect it will, but can you confirm

      set NAME_OUTPUT=-o %OUTDIR%%MEX_NAME%%MEX_EXT%

      works correctly in both R2007b and R2014B (and still produces the correct names when no output file is set on the command line).

       
      • Gunter

        Gunter - 2014-06-03

        This solution seems to work both in R2007b and R2014A. I can correctly produce mexw32 or mexw64 without specifying the file extension. Specifying dll in r2007b produces the desired dll file.
        One issue which hopefully is not connected to this one: Matlab R2007b 32bit complains that the compile dll or mexw32 is not a valid 32 bit application. I am just checking on this.

         
      • Gunter

        Gunter - 2014-06-06

        another change request for this line: add double quotes to support paths with spaces. Surprisingly this is not problem when compiling with Matlab2007b 32bit, but with Matlab2014a 64bit.

        suggestion: set NAME_OUTPUT=-o "%OUTDIR%%MEX_NAME%%MEX_EXT%"

         
        • Richard C

          Richard C - 2014-06-06

          I've now made this change (on svn trunk).

           
  • Tony Kelman

    Tony Kelman - 2014-06-03

    I think we use mexext in the .m Matlab code that populates the mexopts.bat file, so it ends up the same. Isn't MEX_EXT set to mexw32 higher up in the same file?

    Regardless, if you really need a .dll for whatever reason, you can simply rename the mexw32 file. It's exactly the same format anyway, just a different file extension.

     

Log in to post a comment.