[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT FFI: How to load 2 libraries into 2 ffi namespace and avoid conflicts?
- From: Mike Pall <mikelu-1108@...>
- Date: Sun, 28 Aug 2011 13:33:32 +0200
Johnson Lin wrote:
> I was thinking there're reasons behind this design (about loading C
> libraries into different namespaces), but we have only one ffi.cdef,
> thus comes my original question that if we can have different cdef's
> namespaces too. After your explanation, I am thinking then why not:
>
> ffi.load(path_to_LibA); ffi.cdef[[ LibA_declarations... ]]
>
> ffi.C.LibA_Init()
> --or
> local C = ffi.C
> C.LibA_Init()
Sure, you can load a library into the global namespace:
http://luajit.org/ext_ffi_api.html#ffi_load
But that won't work on Windows, because it doesn't have a global
symbol namespace. So yes, there are reasons behind the design of
the FFI library ...
--Mike