Author Topic: How to use BASS library with QTCreator?  (Read 2558 times)

Ironarrow

  • Posts: 6
How to use BASS library with QTCreator?
« on: 5 Feb '13 - 11:35 »
Hi,

i am very new to your project and to C++ programming. I have started to build QT from the source (using this manual http://qt-project.org/wiki/MinGW-64-bit) and now I want to play a mp3 file with my application. A friend of mine told me from your library and now I am here.

I have written a simple test application which raise an "Segmentation fault" when I tried to run an function from the bass.dll. I have a 64bit mingw compiler and I downloaded the 64bit version of your dll from here http://www.un4seen.com/forum/?topic=9038

In the constructor of my QT dialog I want to get the version of the DLL. But when I do the function call, I get the exception.

Code: [Select]
    if (HIWORD(BASS_GetVersion())!=BASSVERSION) {
I looked at the "c"-examples and tried to implement the call the same way. I have attached my test application. Maybe someone can find the error.

Thank you very much.

Regards,

Rainer

Ian @ un4seen

  • Administrator
  • Posts: 26254
Re: How to use BASS library with QTCreator?
« Reply #1 on: 5 Feb '13 - 17:44 »
I have never used Qt or MinGW64, so I'm not familiar with what needs to be done with them, but do they give any errors/warnings when you build your EXE? If you like, you can upload your EXE, and I'll see if I can spot any problems with it.

Ironarrow

  • Posts: 6
Re: How to use BASS library with QTCreator?
« Reply #2 on: 6 Feb '13 - 08:12 »
Hello Ian,

thank you very much for your answer.

I have attached the .o-files and the exe file. I get no errors or warning while building the EXE.

When the bass.dll is missing, the programm crashes direct on program start. but when the dll exists in the same directory like the exe file I can start the debugger and step to the function call "BASS_GetVersion()". But when I execute this command, the application terminates.

So I think the DLL will be referenced correctly.

Ian @ un4seen

  • Administrator
  • Posts: 26254
Re: How to use BASS library with QTCreator?
« Reply #3 on: 6 Feb '13 - 16:30 »
I can't try the EXE as I'm missing some DLLs that it requires, but it appears to be importing the BASS_GetVersion function from BASS.DLL fine. For some clues on why it's crashing, please post the call-stack and registers from the debugger when the crash occurs.

Ironarrow

  • Posts: 6
Re: How to use BASS library with QTCreator?
« Reply #4 on: 6 Feb '13 - 18:35 »
Sorry, my mistake. I have forgotton to add the QT-DLLs. But I have checked them. That where several hundred of megabytes.

I have attached all debugger output that I could find. I hope they are helpful.

Ian @ un4seen

  • Administrator
  • Posts: 26254
Re: How to use BASS library with QTCreator?
« Reply #5 on: 7 Feb '13 - 15:53 »
That's strange. The backtrace appears to be saying that it's in the BASS_GetVersion call, but the address (0x0000000000403350) is still in the EXE rather than BASS.DLL.

It may be that MinGW64 doesn't support MSVC-generated LIB files (such as BASS.LIB), and you will need to generate a MinGW64-compatible import library, as described here...

   http://sourceforge.net/apps/trac/mingw-w64/wiki/Answer%20generation%20of%20DLL%20import%20library

I haven't tested it myself, so I'm not sure if it will work, but here's a library that was generated using those instructions...

   www.un4seen.com/stuff/mingw64-bass.lib

Ironarrow

  • Posts: 6
Re: How to use BASS library with QTCreator?
« Reply #6 on: 7 Feb '13 - 16:44 »
Thank you very much. As soon as I tested the new lib file, I will give you a feedback.

Ironarrow

  • Posts: 6
Re: How to use BASS library with QTCreator?
« Reply #7 on: 10 Feb '13 - 18:52 »
Hm ... sorry for the bad news, but with the new LIB file I have the same problem. :-(

Ian @ un4seen

  • Administrator
  • Posts: 26254
Re: How to use BASS library with QTCreator?
« Reply #8 on: 12 Feb '13 - 16:38 »
That's a shame. Do you actually need to build 64-bit executables? Note 32-bit executables will work on 64-bit Windows too. If you're fine with 32-bit executables, then you could try MinGW instead. That definitely does work with the standard BASS.LIB file (from the Win32 BASS package), as the example EXEs are built with it :)

If you do need 64-bit, it looks like Qt can use Microsoft's compiler too, so perhaps you could try that.

Ironarrow

  • Posts: 6
Re: How to use BASS library with QTCreator?
« Reply #9 on: 12 Feb '13 - 18:49 »
I can use the 32bit compiler, too.

But I have found an other compiler and I would like to test it. But the bass.def file is missing. Can you send it to me?

Ian @ un4seen

  • Administrator
  • Posts: 26254
Re: How to use BASS library with QTCreator?
« Reply #10 on: 13 Feb '13 - 17:02 »
You can generate a DEF file from a DLL file using the "gendef" tool. Here are some details on that...

   http://sourceforge.net/apps/trac/mingw-w64/wiki/gendef

oifii

  • Posts: 10
Re: How to use BASS library with QTCreator?
« Reply #11 on: 2 Mar '24 - 13:39 »
for me, gendef.exe does not work on bass.dll. it creates an empty .def file. did you find a way to generate the .def file. I also need it in order to use dlltool.exe for generating libbass.a. I am also trying to link bass.dll using mingw.