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.
B4X:
#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
Libraries are written in C++. Libraries are made of a single h file and one or more cpp files. Libraries can also include other h files which will not be exposed. All the files should be in the same folder. The attached h2xml jar reads the h file and creates the xml file that is used by the...
Yes, I know how to write libraries and events. While this is great, there is a problem with it, which is that it is not conducive to personalization and maintenance. Modules and inline C can. It also saves resources and multiple calls.
Given that AddressOf is supported, I think this is a good choice.