• Welcome to Theos PowerBasic Museum 2017.

BASS 2.4 MusicLoad, file as ANY? Void *?

Started by Christian McDonald, July 24, 2009, 03:07:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Christian McDonald

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.

Patrice Terrier

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

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

José Roca

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>).