' Mixed Language — B64 via DECLARE
' NOTE: B64 functions can be called via DECLARE when compiled as shared objects
#COMPILE EXE
#DIM ALL

' DECLARE to external B64 or C function
DECLARE FUNCTION MessageBoxA LIB "USER32.DLL" ALIAS "MessageBoxA" (BYVAL hWnd AS LONG, BYVAL lpText AS ASCIIZ PTR, BYVAL lpCaption AS ASCIIZ PTR, BYVAL uType AS LONG) AS LONG

FUNCTION PBMAIN() AS LONG
    LOCAL msg AS STRING
    LOCAL title AS STRING

    msg = "Hello from PB calling Win32 via DECLARE"
    title = "PB Call Demo"

    PRINT "Calling MessageBoxA via DECLARE..."
    MessageBoxA(0, STRPTR(msg), STRPTR(title), 0)

    PRINT "Done"
    FUNCTION = 0
END FUNCTION
