I'm creating an agk plugin dylib using purebasic on a mac. I am able to create regular procedures that can be passed / return integers and floats.
my problems begin when passing strings to the plugin, they become unrecognisable ( See attached image, this should say hello world. ). And using AppGameKit commands from the plugin completely crashes AGK.
Purebasic:
Global AGK_DrawBox : PrototypeC _AGK_DrawBox( x.f, y.f, x2.f, y2.f, col.l, col2.l, col3.l, col4.l, fill.l )
Procedure GetAGKFunction( Decor.s )
EndProcedure
ProcedureCDLL ReceiveAGKPtr( ptr.l )
AGK_DrawBox._AGK_DrawBox = GetAGKFunction ( "DRAWBOX_0_F_F_F_F_L_L_L_L_L" )
EndProcedure
; Strings come through mangled. Wrong encoding?
ProcedureCDLL myMessage( string1.s, string2.s )
MessageRequester( string1, string2)
EndProcedure
; Crashes agk. Works if AGK_DrawBox is removed.
ProcedureCDLL myBox()
color.l = RGB(255,255,255)
AGK_DrawBox( 10,10,10,1, color, color, color, color, 0 )
EndProcedure
AGK:
#import_plugin myPlugin
myPlugin.myMessage( "Hello" , "world" )
do
RegEx.myBox()
Sync()
loop
end
Commands.txt:
#CommandName,ReturnType,ParameterTypes,Windows,Linux,Mac,Android,iOS,Windows64
myMessage,0,SS,0,0,myMessage,0,0,0
myBox,0,0,0,0,myBox,0,0,0
Is anyone able to tell me where I went wrong?
Any help would be appreciated
.