Theos PowerBasic Museum 2017

Archive => Discussion - Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Topic started by: Christian McDonald on July 24, 2009, 03:07:42 AM

Title: BASS 2.4 MusicLoad, file as ANY? Void *?
Post by: Christian McDonald on July 24, 2009, 03:07:42 AM
Trying to learn my way around PowerBasic and BASS. This question is just a general question and something I don't quite understand yet in PowerBasic...

The header files provided on these forums for BASS have this:

DECLARE FUNCTION BASS_MusicLoad LIB "bass.dll" ALIAS "BASS_MusicLoad" ( _
   BYVAL LONG _                               ' BOOL mem
, BYREF ANY _                                ' const void *file
, BYVAL QUAD _                               ' QWORD offset
, BYVAL DWORD _                              ' DWORD length
, BYVAL DWORD _                              ' DWORD flags
, BYVAL DWORD _                              ' DWORD freq
) AS DWORD                                   ' HMUSIC


I've come across this situation multiple times with different functions and DLLs and I get stuck.

So lets say I wanted to pass a filename through the second argument of that function? How do I pass this through an ANY? I have a feeling this involves pointers, but idk.
Title: Re: BASS 2.4 MusicLoad, file as ANY? Void *?
Post by: Patrice Terrier on July 24, 2009, 08:08:52 AM
From the BassBox project:

DECLARE FUNCTION BASS_MusicLoad LIB "bass.dll" ALIAS "BASS_MusicLoad" (BYVAL mem AS LONG, file AS ASCIIZ, BYVAL offset AS QUAD, BYVAL length AS DWORD, BYVAL flags AS DWORD, BYVAL freq AS DWORD) AS LONG

...
Title: Re: BASS 2.4 MusicLoad, file as ANY? Void *?
Post by: José Roca on July 24, 2009, 03:31:57 PM
Quote
So lets say I wanted to pass a filename through the second argument of that function? How do I pass this through an ANY? I have a feeling this involves pointers, but idk.

If you use a variable dimmed as ASCIIZ, then just pass that variable, since ASCIIZ variables are passed by reference. If you use a variable dimmed as STRING, then use BYVAL STRPTR(<string variable>).