[PATCH] Fix C API on Mac OS X

N/A
2013-09-29
2014-09-08
  • N/A
    N/A
    2013-09-29

    It's quite unclear how to contribute to MediaInfo, so I'll post here.

    MediaInfoDLL.h was recently broken on Linux, and later Mac OS X, while using the C API.

    It is incorrect to include the C++ header <new> for size_t.

    Patch to fix can be found here: http://chromashift.org/tools/linux/mediainfodll_c_fix.patch

    EDIT: This should perhaps be included unconditionally?

    Please review.

     
    Last edit: N/A 2013-09-29
  • It's quite unclear how to contribute to MediaInfo, so I'll post here.

    Patches tracker, but I accept patch here too.
    Don't hesitate to contribute more!

    It is incorrect to include the C++ header for size_t.

    crapy code from me :(

    EDIT: This should perhaps be included unconditionally?

    Not sure: it is ok in most other systems. But I definitely not know what is the best practice.

    Currently, I propose:

        #ifdef __cplusplus
         #include <new> //for size_t
        #else /* __cplusplus */
         #include <stddef.h> //for size_t
        #endif /* __cplusplus */
    

    What do you think of it?

     
  • Hi,
    I got recently bitten by this, can this patch be upstreamed?

    I believe the ifdef __cplusplus is not needed as new is implicitly defined in c++ anyway, and the header is of course present in both cases.
    Thanks

     
  • There is theory, there is reality ;-).
    the #include <new> is present because it was not compiling with some C++ compilers used by my users.
    So for the moment I prefer to keep it.

    I had no news about my proposal, but if it works I an add it in next version.

    Is this patch OK in your case?

     
  • I still think it would be cleaner and more standard-compliant to just include stddef.h in either cases. Do you know which compilers were actually broken?

    FWIW the proposed patch fixes OSX compilation as expected.

     
  • Ping on this issue.