vrijdag 31 mei 2013

Using GLFW x64 Visual Studio 2010

Using GLFW x64 Visual Studio 2010:

First compile GLFW with Visual Studio 2010. The solution file is in the support directory. Load the .sln file. Create an x64 active solution platform. Compile with configuration manager option "Release" and your new created "x64" solution platform.
Don't forget to include "GLFW.h".

In ProjectProperties/Linker/System/Subsystem, you can set if the application is a console application or a window application.

If you get: LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
Solve this by setting LIBCMT in the ProjectProperties/Linker/Input/Ignore Specific Default Libraries.

If you get: LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
Solve this by setting the ProjectProperties/Linker/General/Enable Incremental Linking to NO.

dinsdag 21 mei 2013

QueryPerformanceCounter not reliable

If you have a threaded application running on a multicore computer QueryPerformanceCounter can (and will) return different values depending on which core the code is executing on.

http://stackoverflow.com/questions/1825720/c-high-precision-time-measurement-in-windows

I've tested timeGetTime() , but it is also not accurate.

dinsdag 7 mei 2013

Bass, a great 64-bit XM MOD player

I'm working on a little demo which uses CUDA. I installed a 64 bit C compiler for it and the 64-bit version of CUDA.
Now I want some music to play, however minifmod and ufmod both use 32-bit assembly code. This results in Linker errors. "LNK2019: unresolved external symbol". The 64-bit linker cannot link the 32-bit Lib's.

I gave it a try to run the 32-bit DOS-prompt with the 32-bit CL.exe, however the CUDA compiler NVCC still generates 64-bit executables. You can determine that by using: dumpbin /headers <exe-file>
Look in de log presented to you and you will find: 8664 machine (x64)

XMPLib:
XMPLib seems to be a total C XM player, so I tried to compile it. However it is Linux oriented, so you need to do the ./configure,make dance which is not supported by Visual Studio. I installed MINGW on my 64-bit machine. The LibXMP.dll is generated without a problem. However after checking with dumpbin it still is a 32-bit DLL!
After checking the MINGW website, I discovered that MINGW is only 32 bit at this moment! Pheww, the installer didn't mention it when installing MINGW on my 64-bit Windows.

BASS:

But now, there is music, maestro!
BASS ships 64-bit DLL's and LIB's compatible with VS2010.  Download at: www.un4seen.com/stuff/bass24-x64.zip

To start the music simply do:

HMUSIC TheMod;
BASS_Init(-1,44100,0,0,NULL);
char xmfile[] = "CRACKINT.MOD";
TheMod = BASS_MusicLoad(FALSE,xmfile,0,0,BASS_MUSIC_RAMPS,1);
BASS_ChannelPlay(TheMod,FALSE);

and at exit:
BASS_MusicFree(TheMod);
BASS_Free();

Include the bass.h in your C code and link the bass.lib.