Can B4R support operations like AddressOf, so that in inline C, you can use Pointers to pass functions or other types?
Object objects use wrapNumber, not wrapPointer, by default.
[CODE lang="b4x" highlight="25"]
#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 600
#End Region
'Ctrl+Click to open the C code folder: ide://run?File=%WINDIR%\System32\explorer.exe&Args=%PROJECT%\Objects\Src
Sub Process_Globals
Public Serial1 As Serial
Private wifi As ESP8266WiFi
End Sub
Private Sub AppStart
Dim o As Object
Serial1.Initialize(115200)
Log("AppStart")
'example of connecting to a local network
If wifi.Connect2("NantongCorona", "14725836") Then
Log("Connected to network")
Else
Log("Failed to connect to network")
End If
o=fun1
'Like this
'o=AddressOf(fun1)
RunNative("gofun1",o)
End Sub
Private Sub fun1()
Log("Hello World!")
End Sub
#if C
void gofun1(B4R::Object* o)
{
void (*p)();
p=(void(*)())o->data.PointerField;
p();
}
#End If[/CODE]