[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  How can I load third party dll?
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

How can I load third party dll?

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Andy.Liu   (22 posts)  [Biography] bio
Date Tue 07 Mar 2017 07:22 AM (UTC)
Message
Dear Gammon,
I'm facing a problem when loading a third party dll name "luaiconv.dll", which provides encoding/decoding chars functions.

I can run it smoothly in command line in windows via Lua.exe.

When I load my Lua script,It can't find the module.

local iconv = require("luaiconv")
local cd = iconv.new("utf-8","gbk")
local words, err = cd:iconv(text)

There are 3 dlls: luaiconv.dll,iconv.dll,charset.dll .I tried to place them in these folders:1) same folder of the Lua script 2.root path of mush client
3) lua 5.1\clibs

But all failed.

Could you please help this ?

Thanks a lot.
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #1 on Tue 07 Mar 2017 09:53 AM (UTC)

Amended on Tue 07 Mar 2017 09:54 AM (UTC) by Fiendish

Message
Quote:
...a third party dll...

Provide a link to these dlls, please, along with another link to the project page. We don't want to hunt all over the internet looking for something that may or may not be what you're trying to use.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Andy.Liu   (22 posts)  [Biography] bio
Date Reply #2 on Tue 07 Mar 2017 03:53 PM (UTC)
Message
The homepage of luaiconv is http://ittner.github.io/lua-iconv/

The dlls I downloaded is from a chinese developer web site,but I don't think you can download it directly.

http://download.csdn.net/download/sniffer12345/6562595

I can send you email and attach them.

Please provide your email address if possible.

Thanks a lot.
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #3 on Tue 07 Mar 2017 06:47 PM (UTC)

Amended on Tue 07 Mar 2017 06:53 PM (UTC) by Fiendish

Message
The project page says
Quote:
require("iconv")

But you are doing
Quote:

require("luaiconv")


If using iconv instead of luaiconv still doesn't work, please share the files with a service like https://nofile.io/

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Andy.Liu   (22 posts)  [Biography] bio
Date Reply #4 on Wed 08 Mar 2017 01:54 AM (UTC)
Message
Please download it by the following link:

https://share.weiyun.com/3c31f9f1734ad466cbee7e87cd782e14

Thanks.
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #5 on Wed 08 Mar 2017 03:01 PM (UTC)

Amended on Wed 08 Mar 2017 03:07 PM (UTC) by Fiendish

Message
I just put those dlls in my mushclient folder and ran


local iconv = require("luaiconv")
local cd = iconv.new("utf-8","gbk")
local words, err = cd:iconv("hello")
print(words)

And it worked fine for me.

I assume your operating system is in Chinese and not English? Maybe that affects path searching.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Andy.Liu   (22 posts)  [Biography] bio
Date Reply #6 on Wed 08 Mar 2017 11:27 PM (UTC)
Message
yes .It is Chinese Windows
I will try it in English
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #7 on Thu 09 Mar 2017 09:36 AM (UTC)

Amended on Thu 09 Mar 2017 09:49 AM (UTC) by Fiendish

Message
If switching the OS to English works, please let us know. That might be fixable in MUSHclient.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Andy.Liu   (22 posts)  [Biography] bio
Date Reply #8 on Thu 09 Mar 2017 10:35 AM (UTC)
Message
Sorry,I have no pure English Windows OS currently.
I tried utf8/gbk for lua script self.
And nothing changes.
It seems mushclient loaded or found dll successfully,but can't load
module 'luaiconv' successfully.

==============================
Run-time error
World: ashooter
Immediate execution
error loading module 'luaiconv' from file '.\luaiconv.dll':
ÕÒ²»µ½Ö¸¶¨µÄ³ÌÐò¡£

stack traceback:
[C]: ?
[C]: in function 'require'
[string "Script file"]:2: in main chunk
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #9 on Thu 09 Mar 2017 12:38 PM (UTC)

Amended on Thu 09 Mar 2017 01:02 PM (UTC) by Fiendish

Message
Do you have MSVCR100.DLL? I notice luaiconv.dll requires it.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #10 on Thu 09 Mar 2017 01:37 PM (UTC)
Message
For me,

require "tprint"; f = require("luaiconv"); tprint(f)

outputs

"iconv"=function: 0x026cb7e0
"VERSION"="luaiconv r5"
"ERROR_UNKNOWN"=4
"new"=function: 0x026cb800
"ERROR_INVALID"=2
"open"=function: 0x026cb820
"ERROR_INCOMPLETE"=3
"ERROR_NO_MEMORY"=1


I get the same with

require "tprint"; f = assert(package.loadlib("luaiconv.dll", "luaopen_luaiconv"))(); tprint(f)

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Andy.Liu   (22 posts)  [Biography] bio
Date Reply #11 on Fri 10 Mar 2017 01:54 AM (UTC)
Message
Yes,I have msvcr100.dll put in c:\windows\system32 folder.
[Go to top] top

Posted by Andy.Liu   (22 posts)  [Biography] bio
Date Reply #12 on Fri 10 Mar 2017 03:19 AM (UTC)
Message
require("tprint");f = require("luaiconv");tprint(f)

GOT ERROR:

Run-time error
World: ashooter
Immediate execution
error loading module 'luaiconv' from file '.\luaiconv.dll':
The specified procedure could not be found.

stack traceback:
[C]: ?
[C]: in function 'require'
[string "Script file"]:4: in main chunk


require "tprint"; f = assert(package.loadlib("luaiconv.dll", "luaopen_luaiconv"))(); tprint(f)

GOT ERROR:

Run-time error
World: ashooter
Immediate execution
[string "Script file"]:6: The specified procedure could not be found.

stack traceback:
[C]: in function 'assert'
[string "Script file"]:6: in main chunk
[Go to top] top

Posted by Andy.Liu   (22 posts)  [Biography] bio
Date Reply #13 on Fri 10 Mar 2017 03:35 AM (UTC)
Message
Hi,
A good news is that I can load this dll as you did.

I copied all the files in the Lua installed folder to the folder of MushClient and it works.

The bad news is that I don't know why it works now.

I think there are some relative files in the Lua installed folder that MuschClient missing.

The output is :
"ERROR_NO_MEMORY"=1
"ERROR_INCOMPLETE"=3
"iconv"=function: 05AC4C30
"VERSION"="luaiconv r5"
"ERROR_INVALID"=2
"ERROR_UNKNOWN"=4
"open"=function: 05AC1330
"new"=function: 05AC4C50
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #14 on Fri 10 Mar 2017 08:47 AM (UTC)

Amended on Fri 10 Mar 2017 08:49 AM (UTC) by Fiendish

Message
I don't think I even have a Lua install.
Can you pin down which file or files fixed it?

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


2,763 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]