lua-users home
lua-l archive

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


If you're looking for Windows only, check out:

http://www.wdj.com/archive/0908/feature.html

It's a C function that lets you call arbitrary DLL functions. All you'd need
to do is provide a Lua wrapper around this guy to set up the inputs and read
the outputs. This function already does the REALLY hard work of setting up
the stack, calling convention, etc.

-Chris

-----Original Message-----
From: owner-lua-l@tecgraf.puc-rio.br
[mailto:owner-lua-l@tecgraf.puc-rio.br]On Behalf Of Philippe Lhoste
Sent: Monday, February 26, 2001 2:47 AM
To: Multiple recipients of list
Subject: RE: modules


Luiz Henrique de Figueiredo wrote:
> >So, yes we need a good way to add third party libraries to an
> existing Lua
> >executable without having to recompile it.
>
> I think loadlib can help here:
> http://www.tecgraf.puc-rio.br/~rborges/loadlib/
> --lhf

I know loadlib and appreciate it exists (I have not tried it yet) because it
opens an interesting functionality and is portable.
I am not sure how to use it to load other Lua libraries though (still a Lua
beginner!). I will try anyway.

In another (quite related) subject, I am a bit frustrated by this code,
because it is limited to void foo(void) functions.
I am looking for a way to declare any Windows DLL function in a way similar
to VB "Declare Function":
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd
As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

No need to take exactly this syntax, perhaps we should instead create a
table with the needed declarations.
If we can do this, this opens a lot of system integration, we can even do UI
programming in Lua (yes, I know I can already use Tk).
Of course, there are some problems, like mapping Windows types to Lua types,
declaring structures, managing callbacks, etc.
Some work exists already, like the LTN 5, I still have to dive deeply into
it...
So if somebody have already done a similar task, and can share either code
or tips, I would be glad.

Allowing the use of OCX ie. objects, like:
set fso = CreateObject("Scripting.FileSystemObject")
would be a big plus too.
Searching the Web, I found that somebody claimed having done a Lua
integration to WSH (Windows Scripting Host). Does anybody here know where to
find it, if publicly available?

Regards.

--._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/
--´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`·._.·´¯`--