Menu

#183 ssize_t is not defined in windows binary downloads

1.13.1
closed
nobody
None
5
2013-02-24
2012-12-27
No

Using visual studio 2008 and the windows binary downloads, ssize_t is not defined when mpg123.h is included.

Discussion

  • Jonathan Yong

    Jonathan Yong - 2012-12-27

    It is __int64 on win64 and int on win32.

     
  • John Chambers

    John Chambers - 2012-12-27

    OK.

    Here are some of my findings based on looking through the code which of course I may be mistaken about.

    In the source download "ports" directory I think mpg123.h includes mpg123.h.in which correctly defines ssize_t (but it defines it as long). The problem with your binary build is that you are using the wrong mpg123.h.

    There is also no .lib file. I had to generate one using lib.exe but it does not link correctly. I fear that in your build you are not setting __declspec(dllexport). There appears to be no documentation in this library that states LINK_MPG123_DLL should be defined. I think again this is related to mpg123.h being incorrect.

     
  • Jonathan Yong

    Jonathan Yong - 2012-12-27

    What are you talking about? mpg123.h is generated from mpg123.h.in. You are right there is no .lib file, that is because I don't use MSVC.

    As for dllexport, if you read the comments slightly above, you'll notice "These aren't actually in use... seems to work without using libtool". The linker does auto-resolve the dll stubs, so LINK_MPG123_DLL is not exactly important either.

     
  • Jonathan Yong

    Jonathan Yong - 2012-12-27

    Forgot to mention "long" is default because LP64 are more common, afaik, only Windows is LLP64. The MSVC ports may have gotten a bit out of sync.

     
  • John Chambers

    John Chambers - 2012-12-28

    I think if you test your releases in visual studio you will see what I mean. I understand how annoying it is to test like that as I have to do it myself releasing for multiple platforms. But I think it will help a lot because I'm sure you'll easily be able to fix the problem.

    Attachment is a bare bones example with the error at the bottom.

     

    Last edit: John Chambers 2012-12-28
  • Jonathan Yong

    Jonathan Yong - 2012-12-29

    I think I found your issue. Looks like there was a misunderstanding. The mpg123.h in the zips are machine generated for mingw*, MSVC support for C is substandard, so it gets a special "ports" version instead. Use the ones in ports instead, eg:

    cl -c main.cpp -I ports\MSVC++ -I src\libmpg123

    As for import library, generate it with lib.exe from the included .def file, you can try the .dll.a import library, but no guarantees it'll work for MSVC.

     
  • Thomas Orgis

    Thomas Orgis - 2013-02-24
    • status: open --> closed
     

Log in to post a comment.