lua-users home
lua-l archive

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


suluyu wrote:
> If I did not add .def to the dll project, lua can not load the dll.
> I do not know whether this happen because of C++Builder compiler or 
> because of Windows OS?

It's because C++ Builder (by default) adds an underscore in front of
exported C identifiers, so luaopen_foo becomes _luaopen_foo. But
require("foo") looks for luaopen_foo, with no underscore, and cannot
find it. A definition file can direct C++ Builder to make an alias name
containing no underscore.

> When I get a lua5.1.lib from lua5.1.dll,  must use the command "implib 
> -a".  If omit "-a", the dll project using "lua.5.1.lib"  cannot compile 
> successfully.

It's the same story from the other side. C++ Builder expects imported C
identifiers to have a leading underscore, and identifiers in your
lua5.1.dll don't have one (since your lua5.1.dll was not built with C++
Builder). "Implib -a" creates aliases that contain an underscore and
make C++ Builder happy.

-- 
Shmuel