Results 1 to 4 of 4

Thread: Is this the way to link multiple .obj files into Delphi?

  1. #1

    Is this the way to link multiple .obj files into Delphi?

    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) 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.

    Code:
    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:

    [pascal]
    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.[/pascal]

    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:

    [pascal]
    ..
    {$L print.obj}

    Type
    Plua_State = Pointer;

    function _lua_error(L : Plua_State) : Integer; CDecl; External;

    Implementation

    End.[/pascal]

    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

  2. #2

    Re: Is this the way to link multiple .obj files into Delphi?

    What? 35 reads and no replies?
    Now I'm sad

    Seriously, does anyone know if I am doing this the best way?

    I can create a .lib file too, but that isn't usable by Delphi...

    cheers,
    Paul

  3. #3

    Re: Is this the way to link multiple .obj files into Delphi?

    Yeah, there is a better way. Join the effort that is on-going on supporting and building Lua in FPC/Delphi instead of re-inventing the wheel .

    Seriously, there is no good way to embed the Lua library directly into an application in Delphi or Lazarus. I've been working on a complete 5.1 binary compatible port of the Lua VM, but progress is very slow.

    - Jeremy

  4. #4

    Re: Is this the way to link multiple .obj files into Delphi?

    Quote Originally Posted by jdarling
    Yeah, there is a better way. Join the effort that is on-going on supporting and building Lua in FPC/Delphi instead of re-inventing the wheel .

    Seriously, there is no good way to embed the Lua library directly into an application in Delphi or Lazarus. I've been working on a complete 5.1 binary compatible port of the Lua VM, but progress is very slow.

    - Jeremy
    Perhaps if I have time, I could help you with the Lua conversion?

    cheers,
    Paul

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •