Anyone interested in B4A + C ?

JordiCP

Well-Known Member
Licensed User
Hi all,

Some of us come from the C world, programming microcontrollers/embedded sytems, and then have found such a great tool as B4A is. So, as this is my case, I wondered if it is possible to program only in B4A + C

The "normal" way to do it (specially if the C part has already been developed and is "closed") is building a small JAR library which wraps the .so file and then use it from B4A code.

But sometimes both parts (B4A and NDK-C) are being developed at once, in an endless trial-and-error loop. So, this part is longer and tedious (specially with eclipse)

With inline Java, it is possible to avoid this "external" wrapping and do it inside your project. Of course, the C files are to be built with the NDK environment which must be previously set-up
Also (but it requires a tricky setup) C files can be edited in the B4A IDE so you can have only one working environment


If someone finds it interesting I can write a small tutorial/example about it.
 

freedom2000

Well-Known Member
Licensed User
Hi,

I would be interested as I write also code with C for my Pic programs

(but I must admit that I never used C for Android stuff)
 

Beja

Expert
Licensed User
Hi all,
C files can be edited in the B4A IDE so you can have only one working environment
If someone finds it interesting I can write a small tutorial/example about it.
you mean edit it in B4C? because B4A is for A... duh

I would be very interested because I also need easily write embedded software for PIC and Atmel.. I can try (not promise) to
develop an emulator for Z8 and PIC MCUs and some views. Since this is non-GUI app then the emulator will simply mean
a graphical representation of the memory and I/O maps beside the interrupts.

Good luck.
 

IanMc

Well-Known Member
Licensed User
they are too lickle

for example today I was programming the ATTiny85 (atmel) and found that when I tested the code on an Arduino Uno (atmel 328p) it worked great but when I ported it over to the 85 it crashed and burned.

I found that I was casting an Int in my 328 code and the 85 didn't like it.

I found a workaround but to answer your question

B4x is massive

embedded processors are lickle
 

JordiCP

Well-Known Member
Licensed User
I am refering to link C code (written for Android, of course) with B4A and avoid having to compile a Java wrapper library, by doing this part with inline Java

Of course, the C code has to be compiled externally, with the NDK, and there are certain rules specific to Android and also the JNI interface

The possibility to use the B4A IDE to edit the C code is just a plus (and requires some tricks), but it can be edited externally
 
Last edited:

Beja

Expert
Licensed User
Why not write a subset of B4A and send it to a cross compiler for the target MCU, that we also write, instead of to java compiler? for example (Run2)
the B4A subset is not a new compiler, but simply taking notes to use specific syntax and avoid others.. and forget altogether using the libraries except new ones specifically written for the target MCU.

too ambitious, huh!
 
Top