First, I want to apologize for the mistakes or misunderstandings that may occur, as i am not an english native speaker.
Secondly, i've been around for several months, reading and learning, and now that i've ended creating an account, i want to thank all of you guys for the great help this forum has been for me, and for the awesome Love2D framework.
Now, as you have guessed, i have a little problem that i didn't manage to find a fix by myself.
I have this file compiled as a dynamic lib:
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
int square (int a) {
return a*a;
}
Code: Select all
ffi = require "ffi"
ffi.cdef [[
int square (int a);
]]
local test = ffi.load("module_ffi")
output = test.square(4)
io.write(_VERSION .. os.execute("luajit -v") .."\nOutput of square() = " .. output .. "\n")
Code: Select all
lost@wonderland hybrid_C_Lua % luajit main.lua
LuaJIT 2.0.5 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
Lua 5.10
Output of square() = 16
lost@wonderland hybrid_C_Lua % love .
Error: main.lua:7: dlopen(libmodule_ffi.dylib, 5): no suitable image found. Did find:
file system relative paths not allowed in hardened programs
stack traceback:
[string "boot.lua"]:777: in function <[string "boot.lua"]:773>
[C]: in function 'load'
main.lua:7: in main chunk
[C]: in function 'require'
[string "boot.lua"]:570: in function <[string "boot.lua"]:380>
[C]: in function 'xpcall'
[string "boot.lua"]:787: in function <[string "boot.lua"]:780>
[C]: in function 'xpcall'
io.write(_VERSION .. os.execute("luajit -v") .."\nOutput of square() = " .. output .. "\n")
Thanks for your time,
And I hope i could be of help some day.