File tree Expand file tree Collapse file tree 4 files changed +43
-2
lines changed
Expand file tree Collapse file tree 4 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 11cmake_minimum_required (VERSION 3.15 )
2- project (ProXPL VERSION 0.6 .0)
2+ project (ProXPL VERSION 0.7 .0)
33
44# Enable C and C++
55enable_language (C CXX )
Original file line number Diff line number Diff line change @@ -302,6 +302,19 @@ func showcase_stdlib() {
302302}
303303```
304304
305+ ### Foreign Function Interface (FFI)
306+
307+ ProXPL can invoke native C functions from dynamic libraries (` .dll ` , ` .so ` ) using the ` extern ` keyword.
308+
309+ ``` javascript
310+ // Load C standard library
311+ extern " msvcrt.dll" " puts" func c_puts (text);
312+ extern " msvcrt.dll" " abs" func c_abs (n);
313+
314+ c_puts (" Hello from C!" );
315+ let dist = c_abs (- 100 );
316+ ```
317+
305318---
306319
307320## 📦 Package Manager (PRM)
Original file line number Diff line number Diff line change @@ -986,6 +986,34 @@ func main() {
986986main ();
987987```
988988
989+
990+ ---
991+
992+ ## Foreign Function Interface
993+
994+ ProXPL supports loading and calling external native functions using the ` extern ` declaration.
995+
996+ ### Syntax
997+ ``` javascript
998+ extern " libname" " symbol" func name (param1, param2);
999+ ```
1000+
1001+ - ** libname** : Path or name of the dynamic library (` .dll ` , ` .so ` , ` .dylib ` ).
1002+ - ** symbol** : Exact name of the exported symbol in the library.
1003+ - ** name** : Name used to call the function within ProXPL.
1004+ - ** params** : Parameter names (types are marshalled automatically).
1005+
1006+ ### Type Marshalling
1007+
1008+ | ProXPL Type | C Type (Argument) | C Type (Return) |
1009+ | -------------| -------------------| -----------------|
1010+ | ` Number ` | ` int ` / ` double ` | ` int ` (default) |
1011+ | ` String ` | ` char* ` | ` char* ` |
1012+ | ` Bool ` | ` int ` | ` int ` |
1013+ | ` Null ` | ` NULL ` | ` NULL ` |
1014+
1015+ > ** Note** : The current implementation primarily supports integer return types. Support for floating-point and void returns is planned.
1016+
9891017---
9901018
9911019## Conclusion
Original file line number Diff line number Diff line change 22 "name" : " proxpl" ,
33 "displayName" : " ProXPL Language Support" ,
44 "description" : " Syntax highlighting and language support for the ProXPL programming language" ,
5- "version" : " 0.6 .0" ,
5+ "version" : " 0.7 .0" ,
66 "publisher" : " ProXentix" ,
77 "repository" : {
88 "type" : " git" ,
You can’t perform that action at this time.
0 commit comments