Open shiipou opened 4 years ago
To use Vi-v on Android or iOS I will use flutter C interop (dart:ffi) That will allow the usage of Vi-v on each mobile devices.
Here first step of my POC :
The Vi-v lib in V :
This just contain a test function that will be called in a V exe.
Compile the V version of the Vi-v lib into a C file.
The command use the V compiler to translate V into C file. It's supported by default in V.
The C file got too many content to easly find how V translate the V code into C.
Because it include all the V types, structs, and functions. But I did'nt need to see it.
So I've make an empty lib in V and translate it in V to.
And I use the diff
command to see only the translated code without deps.
Here I can see V has generate my function vi_v.test() into a C function named vi_v__test();
So I'll generate the compiled lib to the root folder :
I'm on Mac os, so .dylib
is the dynamic library generated.
On Linux that must be .so
.
To call the lib function on my main program (in V), I just have to include it and to call it.
But I've got an error on the last step :
It should work in this way
#include ...
fn C.vi_v__test() // <- add this
fn main() {
C.vi_v__test()
}
@ken0x0a Thanks, I haven't updated it, But that will be really great to work like this.
Thanks for the tips, Love to see you following this project.
PS: By the way, Just let you know I now will work at part time on it with the help of a student. I hope to make something appear before September.
I'm little late, nothing appear in September because of some points that make me upset with my app. I want the best approach, so I've restarted almost everything.
POC of Vlang library callable like C lib in Android NDK (Or other)
This will help me to know if it better to use
V
for the main base of the app orif I will useC
.