I tried to create a window on Linux(as i undestand you need to use additional libraries in Linux)so i tried to reach the this code using CFFI command
(cffi:foreign-funcall "main" :void :void :int)
The C CODE:
#include <GLFW/glfw3.h>
#include <stdlib.h>
#include <stdio.h>
static void error_callback(int error, const char* description)
{
fputs(description, stderr);
}
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
int main(void)
{
GLFWwindow* window;
...
}
Which works in C. But SBCL gives me error message:
Execution of a form compiled with errors.
Form:
(EXTERN-ALIEN "main" (FUNCTION INT VOID))
Compile-time error:
during macroexpansion of (EXTERN-ALIEN "main" (FUNCTION INT VOID)). Use
*BREAK-ON-SIGNALS* to intercept.
cannot use values types here
[Condition of type SB-INT:COMPILED-PROGRAM-ERROR]
What does this error mean?
Can we call main function in C using CFFI?
Is there a solution?