[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua libraries
- From: Victor Bogado da Silva Lins <bogado@...>
- Date: 29 Jan 2002 13:31:00 -0200
On Tue, 2002-01-29 at 13:10, Roberto Ierusalimschy wrote:
> On 29 Jan 2002, Victor Bogado da Silva Lins wrote:
>
> Another approach is to "wrap" C libraries in Lua, and then use the new
> "require" function to load them. In your program, you would always write
>
> require "libname"
>
> without worring whether you are loading a Lua library or a C library.
> For C libraries, we would put in the lib directory a Lua file like this:
>
> loadlib("/xxx/yyy/.../...")
>
> or even
>
> loadlib("/xxx/yyy/.../...", "initfunc")
>
> To adjust between diferent systems you only need to edit this small file.
>
> Because loadlib is not portable, we should try to keep it as simple as
> possible.
>
I personaly don't like this solution, this would require a diferent
file for each plataform. I think it is cleaner to have a diferent lib
loader for each plataform and a single source for a library for all
plataforms. Perl works this way, and I think python too.
There is a multiplataform library loader in glib, maybe we should check
this.
--
[]'s Victor Bogado da Silva Lins
victor@visgraf.impa.br