[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [LUAJit> Creating a DLL for use with FFI
- From: Kaj Eijlers <bizziboi@...>
- Date: Sat, 7 May 2011 12:12:45 -0700
Hi,
I'm playing around with LUAJit 2.0 and loving it so far. The FFI is amazing, but being a C programmer I wanted to try to at least create and bind a DLL of my own.
But...even my simplest attempt fails...sure I get the DLL and would believe I did the right thing:
It compiles find and creates the DLL (code at the end of the message).
However, I am obviously missing something with this because:
local ffi = require( "ffi" )
local libb = ffi.load("dlltest.dll")
print(libb)
ffi.cdef[[
void printMe(void);
]]
libb.printMe()
yields:
userdata[0x0027d948]
luajit32: glfw-triangle.lua:10: cannot resolve symbol 'printMe': The specified p
rocedure could not be found.
stack traceback:
[C]: in function '__index'
glfw-triangle.lua:10: in main chunk
[C]: ?
Which kinda suggests my symbol was not exported correctly by me.
Environment x86/MSVC/Win7
Anybody have any pointers? DLL tutorials don't seem to mention much more than 'use dllexport'.
Thanks,
Kaj
---------------------------------------------------------------------
// DLLTest.cpp : Defines the exported functions for the DLL application.
//
#include
"stdafx.h"
#include
<stdio.h>
__declspec
(dllexport) void printMe( void )
{
printf(
"Hello\n");
}