luagbk icon indicating copy to clipboard operation
luagbk copied to clipboard

Request for DLL

Open ihkk opened this issue 2 years ago • 4 comments

Hi, I'm a user who is not so familiar with C/C++, and I'm simply trying to use this module transforming strings from UTF-8 into GBK in my lua script. I've tried directly run the sample programme test.lua but it reported with the errors below. I guess maybe I need to compile the module into a dll to enable lua use it? However I do not know the method to compile, so is it possibile if you could give me any suggestions or release a dll file (maybe both 32 and 64bit)? Many thanks for that.

C:\lua54\lua.exe: ...pData\Roaming\Aegisub\automation\include\luagbk\test.lua:1: module 'gbk' not found:
        no field package.preload['gbk']
        no file 'C:\lua54\lua\gbk.lua'
        no file 'C:\lua54\lua\gbk\init.lua'
        no file 'C:\lua54\gbk.lua'
        no file 'C:\lua54\gbk\init.lua'
        no file 'C:\lua54\..\share\lua\5.4\gbk.lua'
        no file 'C:\lua54\..\share\lua\5.4\gbk\init.lua'
        no file '.\gbk.lua'
        no file '.\gbk\init.lua'
        no file 'C:\lua54\gbk.dll'
        no file 'C:\lua54\..\lib\lua\5.4\gbk.dll'
        no file 'C:\lua54\loadall.dll'
        no file '.\gbk.dll'
stack traceback:
        [C]: in function 'require'
        ...pData\Roaming\Aegisub\automation\include\luagbk\test.lua:1: in main chunk
        [C]: in ?

ihkk avatar Feb 08 '22 17:02 ihkk

You could look into my another project https://github.com/starwing/lua-protobuf , in Install section I list the DLL compiling methods. just change the name of library/source file.

starwing avatar Feb 09 '22 08:02 starwing

In widondows, can compile like this: gcc lgbk.c -I lua_header_path -L lua_lib_path -llua53 -s -mdll -O2 -DLUA_BUILD_AS_DLL -o gbk.dll

da1234cao avatar Oct 09 '22 09:10 da1234cao

In widondows, can compile like this: gcc lgbk.c -I lua_header_path -L lua_lib_path -llua53 -s -mdll -O2 -DLUA_BUILD_AS_DLL -o gbk.dll

not sure why, but this did nothing in my environment. i am using mingw gcc, no gbk.dll generated and no error reported...just nothing.

i used vs2019 to compile it successfully.

zengfanfan avatar Oct 10 '22 08:10 zengfanfan

I dont know why. I recommend always using vs or mingw, not both. @zengfanfan

da1234cao avatar Oct 10 '22 14:10 da1234cao