luaJIT FFI
andi via digitalmars-d-ldc
digitalmars-d-ldc at puremagic.com
Wed Apr 27 03:19:18 PDT 2016
On Friday, 15 April 2016 at 04:23:44 UTC, Dan Olson wrote:
> andi <cadetschimmel at gmail.com> writes:
>
>> On Monday, 11 April 2016 at 15:18:47 UTC, Dan Olson wrote:
>>> andi <cadetschimmel at gmail.com> writes:
>>>> [...]
>>>
>>> Hi,
>>>
>>> Can you post details on the problem? Is it a link time error
>>> or
>>> runtime? OS (e.g Linux)? Is main controlled by Lua (not
>>> using a D
>>> main)? If so, you will need to initialize D runtime (rt_init
>>> or
>>> Runtime.initialize).
>>
>> Im using win7 and win10, visual studio 2013 + VisualD and
>> ldc2-0.15.2-beta2-win64-msvc.
>> and im using luaJIT 2.1 beta2
>>
>> i think its easier to simply upload everything i got so far,
>> so here it is my current project:
>> http://seed-engine.com/downloads/seed2_sdk.zip
>>
>> in src/seed2/main.d is my int main()
>> in bin/core/core.lua im testing luaJITs FFI
>>
>> thx again
>
> I haven't used Lua but just looking at your example core.lua,
> it looks just like Lua FFI documentation for calling C code.
> Can you post the actual error you see?
>
> I extracted interesting parts of your zip file. I note that
> your main.d
> has a D main() function, so you don't need to call rt_init().
>
> -- from core.lua --
> local ffi = require("ffi")
> ffi.cdef[[
> void call_dfunction();
> ]]
> print("hello from luaJIT")
> ffi.C.call_dfunction()
>
> -- from main.d --
> extern (C) public void call_dfunction()
> {
> writeln("call_dfunction");
> }
>
> You don't need public though.
sry i was busy with work, but i got the error handling working
now. i refactored the code a bit as well, the interesting part in
D is now in script.d.
http://seed-engine.com/downloads/seed2_sdk.zip
when i try to call call_dfunction i get the error message:
cannot resolve symbol 'call_dfunction': procedure could not be
found
greetings,
Andi
More information about the digitalmars-d-ldc
mailing list