Page 1 of 1

BassModDLL Import to PureLib

Posted: Sun May 25, 2003 6:31 pm
by darklordz
How do i go about this?

Posted: Sun May 25, 2003 8:11 pm
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.

Posted: Sun May 25, 2003 8:25 pm
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....

Posted: Sun May 25, 2003 9:41 pm
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

Posted: Sun May 25, 2003 9:53 pm
by darklordz
Number of params , thanks mate this helps alot....

Posted: Sun May 25, 2003 10:14 pm
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

Posted: Sun May 25, 2003 10:29 pm
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

Posted: Mon May 26, 2003 11:13 am
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...