paul_nicholls
22-05-2009, 07:19 AM
Hi all,
I have a question:
Is there a better/eaiser way of importing multiple .obj files?
Explanation:
For couple of years now I have been using the Lua scripting language
(www.lua.org (http://www.lua.org)) from within Delphi 5 by using the interface unit + supplied
DLL.
Now I want to see if I can embed it into Delphi by not using the DLL but
compiling the source code and linking it into a Delphi unit.
I have downloaded the Lua source code (5.1) from here
http://www.lua.org/ftp/lua-5.1.tar.gz
I then tried following the instructions found at Rudy's Delphi Corner
(http://rvelthuis.de/articles/articles-cobjs.html) for using BCC32 5.5 to
compile and link c code into Delphi.
BCC32 -c *.c
This generated a whole bunch of .obj files from the c code.
I then tried making a Delphi 5 'import' unit like so:
Unit lua_import;
Interface
{$L lapi.obj}
{$L lauxlib.obj}
{$L lbaselib.obj}
{$L lcode.obj}
{$L ldblib.obj}
{$L ldebug.obj}
{$L ldo.obj}
{$L ldump.obj}
{$L lfunc.obj}
{$L lgc.obj}
{$L linit.obj}
{$L liolib.obj}
{$L llex.obj}
{$L lmathlib.obj}
{$L lmem.obj}
{$L loadlib.obj}
{$L lobject.obj}
{$L lopcodes.obj}
{$L loslib.obj}
{$L lparser.obj}
{$L lstate.obj}
{$L lstring.obj}
{$L lstrlib.obj}
{$L ltable.obj}
{$L ltablib.obj}
{$L ltm.obj}
{$L lua.obj}
{$L luac.obj}
{$L lundump.obj}
{$L lvm.obj}
{$L lzio.obj}
{$L print.obj}
Implementation
End.
I compile the unit and it rightly so complains about missing routines like "_lua_error" for example.
So I added in one of the interfaces like so:
..
{$L print.obj}
Type
Plua_State = Pointer;
function _lua_error(L : Plua_State) : Integer; CDecl; External;
Implementation
End.
When I add in the function above it now doesn't complain about that missing routine :)
I don't know if I can actually call the routines yet, but I will try after I
add in all the missing ones :)
cheers,
Paul
I have a question:
Is there a better/eaiser way of importing multiple .obj files?
Explanation:
For couple of years now I have been using the Lua scripting language
(www.lua.org (http://www.lua.org)) from within Delphi 5 by using the interface unit + supplied
DLL.
Now I want to see if I can embed it into Delphi by not using the DLL but
compiling the source code and linking it into a Delphi unit.
I have downloaded the Lua source code (5.1) from here
http://www.lua.org/ftp/lua-5.1.tar.gz
I then tried following the instructions found at Rudy's Delphi Corner
(http://rvelthuis.de/articles/articles-cobjs.html) for using BCC32 5.5 to
compile and link c code into Delphi.
BCC32 -c *.c
This generated a whole bunch of .obj files from the c code.
I then tried making a Delphi 5 'import' unit like so:
Unit lua_import;
Interface
{$L lapi.obj}
{$L lauxlib.obj}
{$L lbaselib.obj}
{$L lcode.obj}
{$L ldblib.obj}
{$L ldebug.obj}
{$L ldo.obj}
{$L ldump.obj}
{$L lfunc.obj}
{$L lgc.obj}
{$L linit.obj}
{$L liolib.obj}
{$L llex.obj}
{$L lmathlib.obj}
{$L lmem.obj}
{$L loadlib.obj}
{$L lobject.obj}
{$L lopcodes.obj}
{$L loslib.obj}
{$L lparser.obj}
{$L lstate.obj}
{$L lstring.obj}
{$L lstrlib.obj}
{$L ltable.obj}
{$L ltablib.obj}
{$L ltm.obj}
{$L lua.obj}
{$L luac.obj}
{$L lundump.obj}
{$L lvm.obj}
{$L lzio.obj}
{$L print.obj}
Implementation
End.
I compile the unit and it rightly so complains about missing routines like "_lua_error" for example.
So I added in one of the interfaces like so:
..
{$L print.obj}
Type
Plua_State = Pointer;
function _lua_error(L : Plua_State) : Integer; CDecl; External;
Implementation
End.
When I add in the function above it now doesn't complain about that missing routine :)
I don't know if I can actually call the routines yet, but I will try after I
add in all the missing ones :)
cheers,
Paul