2

I have a shared library where I have some functions. I want to access them by getting their signature using luajit.

I have a libtest_c.so --> /usr/local/lib

lua --> /usr/local/bin

require("test_c")

stdin:1: module 'test_c' not found:

no field package.preload['test_c']
no file './test_c.lua'
no file '/usr/local/share/luajit-2.0.4/test_c.lua'
no file '/usr/local/share/lua/5.1/test_c.lua'
no file '/usr/local/share/lua/5.1/test_c/init.lua'
no file './test_c.so'
no file '/usr/local/lib/lua/5.1/test_c.so'
no file '/usr/local/lib/lua/5.1/loadall.so'

stack traceback: [C]: in function 'require' stdin:1: in main chunk [C]: at 0x00404270

1 Answer 1

5

Call a function in shared library using Lua:

http://luajit.org/ext_ffi.html

local lib = ffi.load('some.dll')
ffi.cdef[[
  void hello (void);
]]
lib.hello()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.