Is there a way to specify where the bass.dll is? For screensavers, I don't want to place the bass.dll inside the same location as the screensaver (windows) because another version of bass (older or newer) may be there and cause problems. Thanks.
Bass: Specifying another file location?
BlitzMax Modules Forums/Brucey's Modules/Bass: Specifying another file location? Or.....if we could somehow rename the .dll to a specific version name that would work too. Something like bass24.dll etc, etc. Then we could place it in the same folder as the screensaver. (windows)
hmm.. doing some looking at the source. Perhaps I need to edit the .lib file? I see alot of references to bass.dll there. Could we rename the dll to bass24.dll and then edit the .lib file? If so...what editor can I use to edit the .lib file? It comes up fairly garbled in notepad.
You might be able to create a .def from the lib using reimp.exe (it's a mingw util)
With the .def you can create a .a file using the following command :
At the top of the .def is the name of the .dll. Perhaps changing the name before generating the .a will make the linker expect a differently named .dll.
reimp -d bass.lib
With the .def you can create a .a file using the following command :
dlltool -k -d bass.def -l libbass.a
At the top of the .def is the name of the .dll. Perhaps changing the name before generating the .a will make the linker expect a differently named .dll.
Thanks for the reply. But it's a little bit over my head on exactly what to do. Sorry. :(
Tell you what though....if you can research this a bit, find a solution and give me exact detailed instructions what to do in order to make this work so I can use another name of the .dll, (bass24.dll, bass26.dll, etc, etc) I'll send you $50.00 via PayPal for your time. ;) Thanks for considering it. :)
Tell you what though....if you can research this a bit, find a solution and give me exact detailed instructions what to do in order to make this work so I can use another name of the .dll, (bass24.dll, bass26.dll, etc, etc) I'll send you $50.00 via PayPal for your time. ;) Thanks for considering it. :)
Step by Step ;-)
Create a file called bass.def in lib/win32, and fill it with this :
Note the first line. That is the name of the dll you want to link to. (I got the function list from Dependency Walker)
Run this on that .def file :
It creates an archive file. If you search the file, you will see references to the dll you named in the .def. This file should be in lib/win32.
Now, since we have changed the way we intend to link to Bass, we need to change the module in a few places :
In common.bmx, you will see
You need to change it to
Next, on line 131 or so, you will see
You need to remove "win32" (including the quotes), so that it becomes
And finally, in include/bass.h, you will see
You should change it to
These last two changes are required because moving from .lib to .a the imported functions use a different naming convention.
Rebuild the module, build one of the examples (you will need a full build rather than quick), and it should now complain that it can't find your named .dll.
:-)
Create a file called bass.def in lib/win32, and fill it with this :
LIBRARY XXXXXX.dll EXPORTS BASS_Apply3D BASS_ChannelBytes2Seconds BASS_ChannelFlags BASS_ChannelGet3DAttributes BASS_ChannelGet3DPosition BASS_ChannelGetAttribute BASS_ChannelGetData BASS_ChannelGetDevice BASS_ChannelGetInfo BASS_ChannelGetLength BASS_ChannelGetLevel BASS_ChannelGetPosition BASS_ChannelGetTags BASS_ChannelIsActive BASS_ChannelIsSliding BASS_ChannelLock BASS_ChannelPause BASS_ChannelPlay BASS_ChannelRemoveDSP BASS_ChannelRemoveFX BASS_ChannelRemoveLink BASS_ChannelRemoveSync BASS_ChannelSeconds2Bytes BASS_ChannelSet3DAttributes BASS_ChannelSet3DPosition BASS_ChannelSetAttribute BASS_ChannelSetDSP BASS_ChannelSetDevice BASS_ChannelSetFX BASS_ChannelSetLink BASS_ChannelSetPosition BASS_ChannelSetSync BASS_ChannelSlideAttribute BASS_ChannelStop BASS_ChannelUpdate BASS_ErrorGetCode BASS_FXGetParameters BASS_FXReset BASS_FXSetParameters BASS_Free BASS_Get3DFactors BASS_Get3DPosition BASS_GetCPU BASS_GetConfig BASS_GetConfigPtr BASS_GetDSoundObject BASS_GetDevice BASS_GetDeviceInfo BASS_GetEAXParameters BASS_GetInfo BASS_GetVersion BASS_GetVolume BASS_Init BASS_MusicFree BASS_MusicLoad BASS_Pause BASS_PluginFree BASS_PluginGetInfo BASS_PluginLoad BASS_RecordFree BASS_RecordGetDevice BASS_RecordGetDeviceInfo BASS_RecordGetInfo BASS_RecordGetInput BASS_RecordGetInputName BASS_RecordInit BASS_RecordSetDevice BASS_RecordSetInput BASS_RecordStart BASS_SampleCreate BASS_SampleFree BASS_SampleGetChannel BASS_SampleGetChannels BASS_SampleGetData BASS_SampleGetInfo BASS_SampleLoad BASS_SampleSetData BASS_SampleSetInfo BASS_SampleStop BASS_Set3DFactors BASS_Set3DPosition BASS_SetConfig BASS_SetConfigPtr BASS_SetDevice BASS_SetEAXParameters BASS_SetVolume BASS_Start BASS_Stop BASS_StreamCreate BASS_StreamCreateFile BASS_StreamCreateFileUser BASS_StreamCreateURL BASS_StreamFree BASS_StreamGetFilePosition BASS_StreamPutData BASS_StreamPutFileData BASS_Update
Note the first line. That is the name of the dll you want to link to. (I got the function list from Dependency Walker)
Run this on that .def file :
dlltool -k -d bass.def -l libbass.a
It creates an archive file. If you search the file, you will see references to the dll you named in the .def. This file should be in lib/win32.
Now, since we have changed the way we intend to link to Bass, we need to change the module in a few places :
In common.bmx, you will see
?win32 Import "lib/win32/bass.lib"
You need to change it to
?win32 Import "-lbass"
Next, on line 131 or so, you will see
?win32 Extern "win32"
You need to remove "win32" (including the quotes), so that it becomes
?win32 Extern
And finally, in include/bass.h, you will see
#ifndef BASSDEF #define BASSDEF(f) WINAPI f #endif
You should change it to
#ifndef BASSDEF #define BASSDEF(f) f #endif
These last two changes are required because moving from .lib to .a the imported functions use a different naming convention.
Rebuild the module, build one of the examples (you will need a full build rather than quick), and it should now complain that it can't find your named .dll.
:-)
wow! Looking at this right now... will reply after I give it a try! :)
I was able to build the module no problem, but now I'm getting errors during the linking of my program(s). All of the errors seem related to the glue.cpp file?
C:/Program Files/BlitzMax/mod/bah.mod/bass.mod/bass.release.win32.x86.a(glue.cpp.release.win32.x86.o):glue.cpp:(.text+0xba): undefined reference to `BASS_ChannelGetLength@8' C:/Program Files/BlitzMax/mod/bah.mod/bass.mod/bass.release.win32.x86.a(glue.cpp.release.win32.x86.o):glue.cpp:(.text+0xf2): undefined reference to `BASS_ChannelGetPosition@8' C:/Program Files/BlitzMax/mod/bah.mod/bass.mod/bass.release.win32.x86.a(glue.cpp.release.win32.x86.o):glue.cpp:(.text+0x10e): undefined reference to `BASS_ChannelGetPosition@8' C:/Program Files/BlitzMax/mod/bah.mod/bass.mod/bass.release.win32.x86.a(glue.cpp.release.win32.x86.o):glue.cpp:(.text+0x13b): undefined reference to `BASS_ChannelSeconds2Bytes@12' C:/Program Files/BlitzMax/mod/bah.mod/bass.mod/bass.release.win32.x86.a(glue.cpp.release.win32.x86.o):glue.cpp:(.text+0x15a): undefined reference to `BASS_ChannelGetTags@8' C:/Program Files/BlitzMax/mod/bah.mod/bass.mod/bass.release.win32.x86.a(glue.cpp.release.win32.x86.o):glue.cpp:(.text+0x20a): undefined reference to `BASS_StreamGetFilePosition@8' C:/Program Files/BlitzMax/mod/bah.mod/bass.mod/bass.release.win32.x86.a(glue.cpp.release.win32.x86.o):glue.cpp:(.text+0x2a0): undefined reference to `BASS_StreamCreateFileUser@16' C:/Program Files/BlitzMax/mod/bah.mod/bass.mod/bass.release.win32.x86.a(glue.cpp.release.win32.x86.o):glue.cpp:(.text+0x2b8): undefined reference to `BASS_SampleGetInfo@8' C:/Program Files/BlitzMax/mod/bah.mod/bass.mod/bass.release.win32.x86.a(glue.cpp.release.win32.x86.o):glue.cpp:(.text+0x3e4): undefined reference to `BASS_GetDeviceInfo@8' C:/Program Files/BlitzMax/mod/bah.mod/bass.mod/bass.release.win32.x86.a(glue.cpp.release.win32.x86.o):glue.cpp:(.text+0x411): undefined reference to `BASS_RecordGetInfo@4' C:/Program Files/BlitzMax/mod/bah.mod/bass.mod/bass.release.win32.x86.a(glue.cpp.release.win32.x86.o):glue.cpp:(.text+0x4a4): undefined reference to `BASS_ChannelGetInfo@8'
You didn't modify bass.h ?
You also then need to ensure the glue is recompiled.
... "And finally, in include/bass.h, you will see" ...
You also then need to ensure the glue is recompiled.
... "And finally, in include/bass.h, you will see" ...
Yes, I did all as requested. hmm... when I re-built the module, I assumed it recomiled the glue as well? If not...how do I re-compile the glue? Thanks.
just edit the file - you can add then remove a character - just to get the filestamp updated.
The error is due to the "WINAPI" definition in the functions that the C++ glue is calling. With the new .a file, they should not include WINAPI. - hence the change to the header (bass.h)
If you have changed all of this, and it still doesn't work, perhaps it is picking up a header from elsewhere? (but I doubt it would do that on Windows).
The error is due to the "WINAPI" definition in the functions that the C++ glue is calling. With the new .a file, they should not include WINAPI. - hence the change to the header (bass.h)
If you have changed all of this, and it still doesn't work, perhaps it is picking up a header from elsewhere? (but I doubt it would do that on Windows).
BlitzMax will only recompile files it thinks need compiling. If you have a cpp file like we have here, modifying a .bmx in the same module will not cause the cpp to be re-compiled.
You can of course Build on the command-line using the -a option, which will force a (Re)build of the module - compiling everything, regardless.
I guess I should have made "Rebuild the module" in bold, in the post :-)
You can of course Build on the command-line using the -a option, which will force a (Re)build of the module - compiling everything, regardless.
I guess I should have made "Rebuild the module" in bold, in the post :-)
Ok..first off, thanks for helping. I think we're close. :) I was able to rebuild the mod, I get no errors during compiling an app now. But now when the app runs, I'm getting various "unhandled memory exception errors".
"example01.bmx" errors on:
"Local length:Long = channel.GetLength(BASS_POS_BYTE)"
"example02.bmx" works ok.
"example03.bmx" errors on "info = TBass.GetDeviceInfo(i)"
"example04.bmx" errors on "Local stream:TBassChannel = New TBassStream.CreateMem(IncbinPtr("resources/bass_track_baby.mp3"), IncbinLen("resources/bass_track_baby.mp3""
"example05.bmx" works ok.
Do these examples work on your end when changing the name of the dll using your step examples?
Thanks again.
"example01.bmx" errors on:
"Local length:Long = channel.GetLength(BASS_POS_BYTE)"
"example02.bmx" works ok.
"example03.bmx" errors on "info = TBass.GetDeviceInfo(i)"
"example04.bmx" errors on "Local stream:TBassChannel = New TBassStream.CreateMem(IncbinPtr("resources/bass_track_baby.mp3"), IncbinLen("resources/bass_track_baby.mp3""
"example05.bmx" works ok.
Do these examples work on your end when changing the name of the dll using your step examples?
Thanks again.
Went ahead and did everthing from scratch, downloaded the latest via SVN, followed the instructions, etc. Still same problems.
For the heck of it, did you (Brucey) get a chance to rename the dll and run your examples? Thanks for your continued help.
For the heck of it, did you (Brucey) get a chance to rename the dll and run your examples? Thanks for your continued help.
Okay.... version 2 ;-)
I've started again, and think I've found a better implementation - at last!
The .def file is different this time, with those win32 bits on the end of each function.
Create a file called bass.def in lib/win32, and fill it with this :
Note the first line. That is the name of the dll you want to link to. (I got the function list from Dependency Walker)
Run this on that .def file :
It creates an archive file. If you search the file, you will see references to the dll you named in the .def. This file should be in lib/win32.
Now, since we have changed the way we intend to link to Bass, we need to change the module in a few places :
In common.bmx, you will see
You need to change it to
Different to last time, you can keep the "win32" reference in common.bmx, and you don't need to change bass.h (hence, you also keep the WINAPI bit in there).
See how you get on with that.
I've started again, and think I've found a better implementation - at last!
The .def file is different this time, with those win32 bits on the end of each function.
Create a file called bass.def in lib/win32, and fill it with this :
LIBRARY XXXXXX.dll EXPORTS BASS_Apply3D@0 BASS_ChannelBytes2Seconds@12 BASS_ChannelFlags@12 BASS_ChannelGet3DAttributes@28 BASS_ChannelGet3DPosition@16 BASS_ChannelGetAttribute@12 BASS_ChannelGetData@12 BASS_ChannelGetDevice@4 BASS_ChannelGetInfo@8 BASS_ChannelGetLength@8 BASS_ChannelGetLevel@4 BASS_ChannelGetPosition@8 BASS_ChannelGetTags@8 BASS_ChannelIsActive@4 BASS_ChannelIsSliding@8 BASS_ChannelLock@8 BASS_ChannelPause@4 BASS_ChannelPlay@8 BASS_ChannelRemoveDSP@8 BASS_ChannelRemoveFX@8 BASS_ChannelRemoveLink@8 BASS_ChannelRemoveSync@8 BASS_ChannelSeconds2Bytes@12 BASS_ChannelSet3DAttributes@28 BASS_ChannelSet3DPosition@16 BASS_ChannelSetAttribute@12 BASS_ChannelSetDSP@16 BASS_ChannelSetDevice@8 BASS_ChannelSetFX@12 BASS_ChannelSetLink@8 BASS_ChannelSetPosition@16 BASS_ChannelSetSync@24 BASS_ChannelSlideAttribute@16 BASS_ChannelStop@4 BASS_ChannelUpdate@8 BASS_ErrorGetCode@0 BASS_FXGetParameters@8 BASS_FXReset@4 BASS_FXSetParameters@8 BASS_Free@0 BASS_Get3DFactors@12 BASS_Get3DPosition@16 BASS_GetCPU@0 BASS_GetConfig@4 BASS_GetConfigPtr@4 BASS_GetDSoundObject@4 BASS_GetDevice@0 BASS_GetDeviceInfo@8 BASS_GetEAXParameters@16 BASS_GetInfo@4 BASS_GetVersion@0 BASS_GetVolume@0 BASS_Init@20 BASS_MusicFree@4 BASS_MusicLoad@28 BASS_Pause@0 BASS_PluginFree@4 BASS_PluginGetInfo@4 BASS_PluginLoad@8 BASS_RecordFree@0 BASS_RecordGetDevice@0 BASS_RecordGetDeviceInfo@8 BASS_RecordGetInfo@4 BASS_RecordGetInput@8 BASS_RecordGetInputName@4 BASS_RecordInit@4 BASS_RecordSetDevice@4 BASS_RecordSetInput@12 BASS_RecordStart@20 BASS_SampleCreate@20 BASS_SampleFree@4 BASS_SampleGetChannel@8 BASS_SampleGetChannels@8 BASS_SampleGetData@8 BASS_SampleGetInfo@8 BASS_SampleLoad@28 BASS_SampleSetData@8 BASS_SampleSetInfo@8 BASS_SampleStop@4 BASS_Set3DFactors@12 BASS_Set3DPosition@16 BASS_SetConfig@8 BASS_SetConfigPtr@8 BASS_SetDevice@4 BASS_SetEAXParameters@16 BASS_SetVolume@4 BASS_Start@0 BASS_Stop@0 BASS_StreamCreate@20 BASS_StreamCreateFile@28 BASS_StreamCreateFileUser@16 BASS_StreamCreateURL@20 BASS_StreamFree@4 BASS_StreamGetFilePosition@8 BASS_StreamPutData@12 BASS_StreamPutFileData@12 BASS_Update@4
Note the first line. That is the name of the dll you want to link to. (I got the function list from Dependency Walker)
Run this on that .def file :
dlltool -k -d bass.def -l libbass.a
It creates an archive file. If you search the file, you will see references to the dll you named in the .def. This file should be in lib/win32.
Now, since we have changed the way we intend to link to Bass, we need to change the module in a few places :
In common.bmx, you will see
?win32 Import "lib/win32/bass.lib"
You need to change it to
?win32 Import "-lbass"
Different to last time, you can keep the "win32" reference in common.bmx, and you don't need to change bass.h (hence, you also keep the WINAPI bit in there).
See how you get on with that.
Doing some testing. So far the results are very promising. ;) Will reply later after several Vista machines tested.
Everthing "seems" to be working well. No problems found. However, several techies have told me not to rename the dll, to keep it "bass.dll" and at program startup, just point to the folder where the .dll is located at.
So, is there a way to reference the .dll from another location other than the root of the app? Going back to what the topic was mainly about. :) Thanks.
So, is there a way to reference the .dll from another location other than the root of the app? Going back to what the topic was mainly about. :) Thanks.
They did, hey?
Well, the "other" way to do it is to use LoadLibrary, and reference all the functions as global function pointers - like how the openal module works.
Well, the "other" way to do it is to use LoadLibrary, and reference all the functions as global function pointers - like how the openal module works.
hmmm... I prefer to stick with how it's working now with the renamed procedure. ;) I'm doing more tests today. Turns out the 2 Vista machines I have been testing on didn't have UAC turned on.
Hi Brucey, everything is working well on Vista. I have donated $50.00 as promised for your time. I'm sure we'll do business again. :) :) :)
Thanks very much :-)
Glad you got it all sorted out in the end!!
Glad you got it all sorted out in the end!!