Is it possible to call C functions? #719
-
This feature is called Foreign Function Interface (or FFI) in other languages. |
Beta Was this translation helpful? Give feedback.
Replies: 17 comments 50 replies
-
Yes, the language has support for calling C functions declared in shared libraries (only C functions so far, maybe later C++ as well). For example, in system\net\win_sockets.l, a function from WS2_32 shared library is called:
|
Beta Was this translation helpful? Give feedback.
-
There are still many things not clear. For example, I only need to |
Beta Was this translation helpful? Give feedback.
-
For example, I want to use the Win32 APIs MultiByteToWideChar() and WideCharToMultiByte(). Can you give me example code? |
Beta Was this translation helpful? Give feedback.
-
How to handle callback functions? Some C functions expect a function pointer as parameter. |
Beta Was this translation helpful? Give feedback.
-
I'm translating this C code to ELENA:
Download IUP: https://sourceforge.net/projects/iup/files/3.32/Windows%20Libraries/Dynamic/iup-3.32_Win64_dll17_lib.zip/download |
Beta Was this translation helpful? Give feedback.
-
I find out that I have to write Could you introduce a new syntax extension to help with this? |
Beta Was this translation helpful? Give feedback.
-
The old syntax Error: Entry Point Not Found |
Beta Was this translation helpful? Give feedback.
-
If the external function returns a string, how can I get it? If the external function returns a struct, how can I get and process it? |
Beta Was this translation helpful? Give feedback.
-
How to do type casting in ELENA? |
Beta Was this translation helpful? Give feedback.
-
Does ELENA use
|
Beta Was this translation helpful? Give feedback.
-
Hi. I found that I can't use BTW, what are the differences between |
Beta Was this translation helpful? Give feedback.
-
As Elena can compile to native code, what do you think about making it possible to write a dll in Elena and use it in other languages like C? The language being garbage collected is not a problem, I think. I have seen dll written in Objective C. |
Beta Was this translation helpful? Give feedback.
-
@arakov This code no longer compile. What's going on?
|
Beta Was this translation helpful? Give feedback.
-
Currently playing with GNUStep. Can you tell me why this code doesn't work? I ported it from Python:
|
Beta Was this translation helpful? Give feedback.
-
The C function returns a function pointer. How can I use this function pointer in ELENA?
The function
|
Beta Was this translation helpful? Give feedback.
-
I'm interested in passing C strings ( p/s: Maybe array of array of C strings ( |
Beta Was this translation helpful? Give feedback.
-
How to deal with variadic functions like |
Beta Was this translation helpful? Give feedback.
Yes, the language has support for calling C functions declared in shared libraries (only C functions so far, maybe later C++ as well).
For example, in system\net\win_sockets.l, a function from WS2_32 shared library is called: