This is the code (it's just an example for the windows "Beep" function):
Code: Select all
EnableExplicit
#lib=0
Global *address
If OpenLibrary(#lib,"kernel32.dll")=0
Debug("dll not found")
End
EndIf
ExamineLibraryFunctions(#lib)
While NextLibraryFunction()
If LibraryFunctionName()="Beep"
*address=LibraryFunctionAddress()
Break
EndIf
Wend
CloseLibrary(#lib)
If *address=0
Debug("address not found")
End
EndIf
Debug("calling from purebasic - works with 32 and 64bit compiler")
CallFunctionFast(*address,100,500) ; works!
Delay(1000)
Debug("calling from assembler - only works with 32 bit compiler")
!push 500 ; beep len in ms
!push 200 ; beep frequency
!CALL [p_address]
Delay(1000)
End
PLEASE: Don't ask for the "why". Just tell me, what is wrong with the code. Thank you very much.