starwing/luautf8

Require string

daurnimator opened this issue · 1 comments

Reported by @nadako

A require string that contains "-" undergoes a translation to "_" when looking for a C symbol.

luautf8 should use a require string and .so name of just "utf8" instead of the current "lua-utf8"

A require string that contains "-" undergoes a translation to "_" when looking for a C symbol.

That's not true actually, as Lua docs say:

Once it finds a C library, this searcher first uses a dynamic link facility to link the application with the library. Then it tries to find a C function inside the library to be used as the loader. The name of this C function is the string "luaopen_" concatenated with a copy of the module name where each dot is replaced by an underscore. Moreover, if the module name has a hyphen, its prefix up to (and including) the first hyphen is removed. For instance, if the module name is a.v1-b.c, the function name will be luaopen_b_c.

The issue arises when trying to compile luautf8 with luarocks on Windows, it generates a .def file with the invalid export function name: luaopen_lua-utf8 (or something like that), so I think it's more of a luarocks issue. I'm not familiar with lua world though, so I haven't reported any issue neither here, nor to luarocks repo.