Closed Axle-Ozz-i-sofT closed 1 year ago
Hi This is solved thanks to the help from FreeBASIC forum.
Use the following format replacing (4) with the number of string elements in the array: dim as zstring ptr TextArray( 4 ) = { @"This", @"is", @"a", @"text", @"array" } mycfunction( @TextArray( 0 ) )
Remember to use the "Address of" '@' when passing the array "@TextArray( 0 )" to the C function in the dll/so.
C array and function definition: const char TextArray[5] = { "This", "is", "a", "text", "array", }; int MyCFunction( const char **text);
dim as zstring ptr listViewExList( 7 ) = { @"This", @"is", @"a", @"list view", @"with", @"disable", @"elements", @"amazing!" }
listViewExActive = GuiListViewEx((Rectangle){ 165, 180, 140, 200 }, @listViewExList(0), 8, &listViewExFocus, &listViewExScrollIndex, listViewExActive);
Axle
Hi I have been attempting to get the FB array and variations of ZString Ptr array to pass to the GuiListViewEx() used in "raygui_controls_test_suite.bas" converted from ./raygui/examples/raygui_controls_test_suite.c I have tried multiple variations of the listViewExList and GuiListViewEx( ... ) as well as the raygui.bi "byval text as const zstring ptr ptr", "byref text as const zstring ptr ptr", "text as const zstring ptr ptr".
From raygui.bi v2.6 (fb-raylib v3.5) ./example/raygui_controls_test_suite.bas:
WIITD/raylib 4.1.x
What I have tried + many more random variations:
I notice in the glasyalabolasfb-raylib v 2.6 uses overloading. Any thoughts? I may try swapping out/altering the header to use overloading see what happens when I get time. Axle
P.S. I tried using the overloaded function definition from fb-raylib/gui_2.6, but that failed. Prob the only other thing I can do at this stage is re-build the raylib.dll with a bebug routine to see what is being passed. That being said, GuiListView() is just a wrapper for GuiListViewEx(), so I can prob just leave it out.. But, looking at the pointer sent to GuiListViewEx() from GuiListView() it seams to be formated by GuiTextSplit() as a single string delimited by '\n'. result[len] = "Item-one\nItem-two\nItem-three", ''\0' or to put it another way GuiListView takes "Charmander;Bulbasaur;#18#Squirtel;Pikachu;Eevee;Pidgey" and is converted to "Charmander\nBulbasaur\n#18#Squirtel\nPikachu\nEevee\nPidgey" for GuiListViewEx Axle does self face palm. I'll let you know.