lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


If the Lua file is mymodule.lua, then it might work if you rename the
dll to c-mymodule.dll (or any other prefix followed by a hyphen).
require "mymodule" should load the Lua file, and require "c-mymodule"
should load the DLL, calling luaopen_mymodule

On Fri, Sep 4, 2009 at 2:21 PM, Joshua Jensen<jjensen@workspacewhiz.com> wrote:
> ----- Original Message -----
> From: Jerome Vuarand
> Date: 9/4/2009 6:42 AM
>>
>> This all comes down to the fact that C don't allow embedding large
>> text files in programs easily, or that some people write Lua modules.
>> It's very nice that some people (like the Lua authors) take time to
>> write C modules when they could take less time to do the same in pure
>> Lua or a C/Lua hybrid, but as the language becomes popular and the
>> "level" of modules gets higher, doing it all in C is just too much
>> work.
>>
>
> This reminds me of a gripe that has been brought up before, but it bit me
> again the other day.  Someone, please tell me I am doing it wrong.
>
> I have a module that has a mymodule.lua file and a mymodule.dll.  I want to
> require 'mymodule' and have it load both mymodule.lua and mymodule.dll.
>  Instead, I have to have mymodule.lua require 'mymodule.core' (or something
> similar) and change the exported symbol to luaopen_mymodule_core, so that
> mymodule.dll can be loaded.  This was a pain, because initially, there was
> only a mymodule.dll with the export luaopen_mymodule, and when I added
> mymodule.lua, I had to find the code for and recompile mymodule.dll with a
> changed export.
>
> Is there a better way?