BassModDLL Import to PureLib

Just starting out? Need help? Post your questions and find answers here.
darklordz
Enthusiast
Enthusiast
Posts: 119
Joined: Wed May 21, 2003 1:44 pm
Location: Netherlands
Contact:

BassModDLL Import to PureLib

Post by darklordz »

How do i go about this?
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post by tinman »

Write a ".pbl" file which is basically the names of the functions in the DLL as a text file. The exact format is in the readme for the DLL import tool I think.

Then run the DLL import tool and copy the PureLibrary to your PureLibraries directory somewhere.

If there are lots of functions and you cannot be bothered doing it by hand there are tools such as pexports and impdef which you can find links for here. You still need to manually edit the files to get them into the correct format though.

Alternatively, the user VPureBasic has a small tool which can extract the information in the correct format. It also sounds like Fred is doing something like that for the future too.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
darklordz
Enthusiast
Enthusiast
Posts: 119
Joined: Wed May 21, 2003 1:44 pm
Location: Netherlands
Contact:

Post by darklordz »

Thanks for teh reply, ive read most documentation i could find i have 1 problem tough. in the pbl files we have functions right. now look @ this example

BASSMOD.dll
BASSMOD_ErrorGetCode DATA

the above is the output i received from pexport, the data should be a integer that will be passed onto the dll, so will someone plz explain howto exactly write this into the pbl file....
FloHimself
Enthusiast
Enthusiast
Posts: 229
Joined: Wed May 14, 2003 3:38 pm
Location: Lüneburg - Germany

Post by FloHimself »

from readme.txt:
I. Building a DLL Definition file
---------------------------------

The DLL Definition file is a list of all the DLL functions you want to support
in PureBasic. It's plain ASCII and use a very easy format:

DLLNAME.DLL
Function1 NbParameters
Function2 NbParameters
Function3 NbParameters
...

Comments are accepted, using the ';' character.

Example (which works with the DLLSample.pb example):

; PureBasic DLL import file
;
PUREBASIC.DLL
EasyRequester 1

Once the file is finished, just save it with the .pbl (PureBasic Library) extension.
first line is the name of the dll file.
then follows each function name with the number of parameters.
so the pbl for bassmod should look like: (NOT TESTED YET!)
BASSMOD.DLL
BASSMOD_GetVersion 0
BASSMOD_GetDeviceDescription 1
BASSMOD_ErrorGetCode 0
BASSMOD_Init 3
BASSMOD_Free 0
BASSMOD_GetCPU 0
BASSMOD_SetVolume 1
BASSMOD_GetVolume 0
BASSMOD_MusicLoad 5
BASSMOD_MusicFree 0
BASSMOD_MusicGetName 0
BASSMOD_MusicGetLength 1
BASSMOD_MusicPlay 0
BASSMOD_MusicPlayEx 3
BASSMOD_MusicSetAmplify 1
BASSMOD_MusicSetPanSep 1
BASSMOD_MusicSetPositionScaler 1
BASSMOD_MusicIsActive 0
BASSMOD_MusicStop 0
BASSMOD_MusicPause 0
BASSMOD_MusicSetPosition 1
BASSMOD_MusicGetPosition 0
BASSMOD_MusicSetSync 4
BASSMOD_MusicRemoveSync 1
darklordz
Enthusiast
Enthusiast
Posts: 119
Joined: Wed May 21, 2003 1:44 pm
Location: Netherlands
Contact:

Post by darklordz »

Number of params , thanks mate this helps alot....
darklordz
Enthusiast
Enthusiast
Posts: 119
Joined: Wed May 21, 2003 1:44 pm
Location: Netherlands
Contact:

Post by darklordz »

I created my own pbl file

Code: Select all

BASSMOD.dll
BASSMOD_ErrorGetCode 0
BASSMOD_Free 0
BASSMOD_GetCPU 0
BASSMOD_GetDeviceDescription 1
BASSMOD_GetVersion 0
BASSMOD_GetVolume 0
BASSMOD_Init 3
BASSMOD_MusicFree 0
BASSMOD_MusicGetLength 1
BASSMOD_MusicGetName 0
BASSMOD_MusicGetPosition 0
BASSMOD_MusicIsActive 0
BASSMOD_MusicLoad 5
BASSMOD_MusicPause 0
BASSMOD_MusicPlay 0
BASSMOD_MusicPlayEx 3
BASSMOD_MusicRemoveSync 1
BASSMOD_MusicSetAmplify 1
BASSMOD_MusicSetPanSep 1
BASSMOD_MusicSetPosition 1
BASSMOD_MusicSetPositionScaler 1
BASSMOD_MusicSetSync 4
BASSMOD_MusicStop 1
BASSMOD_SetVolume 1
i imported the lib, certain files were created but 1 problem, i can't use teh cmd's internaly because they are not recognized. and yes i restarted PB
FloHimself
Enthusiast
Enthusiast
Posts: 229
Joined: Wed May 14, 2003 3:38 pm
Location: Lüneburg - Germany

Post by FloHimself »

Ok, I assume that you have pointed the DLL-IMPORTER to the PureLibrary Path correctly.

Next step is to copy the BASSMOD.DLL to the [YOUR_PUREBASIC_PATH]\Compilers\ path, so the compiler can find the dll when hitting compile / run from Purebasic Editor.

Then you can call the functions from dll like WIN API functions.
Try:

Code: Select all

Debug BASSMOD_ErrorGetCode_() ;should return 0 here
Edit: btw: check your pbl file!
BASSMOD_MusicStop 1
should be:
BASSMOD_MusicStop 0
darklordz
Enthusiast
Enthusiast
Posts: 119
Joined: Wed May 21, 2003 1:44 pm
Location: Netherlands
Contact:

Post by darklordz »

Thanks, i did put the dll into the compilers dir, odly enough after i rebooted my pc it did work.....So thanks for the help mates...
Post Reply