As in the other B4X tools you can embed C or C++ code in the project.
Example:
Code:
Sub Process_Globals
Public Serial1 As Serial
Private Result, N1, N2 As Int 'ignore
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
N1 = 10
N2 = 20
RunNative("Add", Null)
Log("Result: ", Result)
End Sub
#if C
void Add (B4R::Object* o) {
//lower case variables
b4r_main::_result = b4r_main::_n1 + b4r_main::_n2;
}
#End if
Inline C / C++
from B4X Community - Android, iOS, desktop, server and IoT programming tools http://ift.tt/1VnbCem
via IFTTT
Aucun commentaire:
Enregistrer un commentaire