12-03-2004, 07:26 AM
here's a working example (you need to have liballeg.a in the fb lib/ dir):
doesn't do much yet... help! v1ctor or somebody - how do I get at C externs? If I was just writing straight gas asm, i could use 'extrn' - is there an fb keyword for that?
Code:
Declare Function install_allegro CDecl Lib "alleg" (ByVal system_id As Integer, ByRef errno_ptr As Integer, ByVal atexit_ptr As Function()) As Integer
Declare Sub allegro_message CDecl Lib "alleg" (ByVal s As String)
Declare Sub allegro_exit CDecl Lib "alleg" ()
Declare Sub atexit CDecl Lib "crtdll" ()
Const SYSTEM_AUTODETECT = 0
Option Explicit
Dim Shared errno As Integer
Function allegro_init() As Integer
allegro_init = install_allegro(SYSTEM_AUTODETECT, errno, ProcPtr(atexit))
End Function
'''
Dim ret As Integer
ret = allegro_init()
Print "ret = "; ret
Print "after allegro_init()..."
Call allegro_message("Hello, world!" + chr$(13) + "Press ok to exit")
Print "before allegro_exit()..."
allegro_exit
Print "after allegro_exit()..."
doesn't do much yet... help! v1ctor or somebody - how do I get at C externs? If I was just writing straight gas asm, i could use 'extrn' - is there an fb keyword for that?