Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern "C" {
- #include "lua.h"
- #include "lualib.h"
- #include "lauxlib.h"
- #include "luajit.h"
- }
- #include <stdlib.h>
- #include <conio.h>
- void ffitest10()
- {
- printf("ffi test 10 hello\n");
- }
- extern "C" __declspec(dllimport) void lj_clib_jimontest_add(const char * name, void * ptr);
- const char * luacode = R"(
- print("start in lua")
- ffi = require("ffi")
- ffi.cdef
- [[
- int printf(const char *fmt, ...);
- void ffitest10();
- ]]
- setmetatable(_G, {__index = ffi.C})
- printf("Hello %s!\n", "world")
- ffitest10()
- print("end in lua")
- )";
- int main()
- {
- lua_State * L = lua_open();
- luaL_openlibs(L);
- lj_clib_jimontest_add("ffitest10", &ffitest10);
- luaL_dostring(L, luacode);
- lua_close(L);
- printf("press any key\n");
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement