Results 1 to 7 of 7

Thread: using .obj in delphi

  1. #1

    using .obj in delphi

    I'm trying to compile a library to use with delphi, i can compile the library perfectly on GCC, but unfortunately GCC .o files are not compatible with delphi

    so i tried compiling with BCC5.5 , it compiles nice, generates a .obj file for each .c,

    i used {$link xxx.obj} on all generated .obj , declared all needed C missing routines,

    but Delphi complains about functions not declared

    Unsatisfied forward or external declaration: '_bitindex'
    etc..

    but these functions are under the C files i compiled :roll:

    how to solve the problem? :?
    From brazil (:

    Pascal pownz!

  2. #2

    using .obj in delphi

    It means the obj uses external function "_bitindex", which you need to implement in your pascal program before it will link properly (yes obj linking works both ways, you use obj function and obj may need a few of your functions back).
    This is my game project - Top Down City:
    http://www.pascalgamedevelopment.com...y-Topic-Reboot

    My OpenAL audio wrapper with Intelligent Source Manager to use unlimited:
    http://www.pascalgamedevelopment.com...source+manager

  3. #3

    using .obj in delphi

    [quote="Delfi"]It means the obj uses external function "_bitindex", which you need to implement in your pascal program before it will ]


    i need to rewrite these funcs on delphi :shock: ?
    From brazil (:

    Pascal pownz!

  4. #4

    using .obj in delphi

    i think he means you need to declare the function header in delphi before importing the .obj.
    didn't do that before but i think it's similar to dlls... :?

  5. #5

    using .obj in delphi

    perhaps this can be useful:
    http://rvelthuis.de/articles/articles-cobjs.html

    especially the
    [pascal]
    implementation

    uses
    SysUtils;

    {$LINK 'regexp.obj'}

    function _regcomp(exp: PChar): PRegExp; cdecl; external;
    function _regexec(prog: PRegExp; str: PChar): LongBool; cdecl;
    external;
    function _reggeterror: Integer; cdecl; external;
    procedure _regseterror(Err: Integer); cdecl; external;

    end.
    [/pascal]
    part

  6. #6

    using .obj in delphi

    the longer you searrch the better the results get :lol:

    http://dn.codegear.com/ru/article/10156#H11

    [pascal]
    unit DAPPMAIN;

    interface

    uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
    Dialogs,
    StdCtrls;

    type
    TMain = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
    private
    { Private declarations }
    public
    { Public declarations }
    end;

    var
    Main: TMain;

    implementation

    {$R *.DFM}

    {Specify the name of the OBJ containing the function.}
    {$L cobj.obj}

    procedure COBJ_Function; StdCall; far; external;

    procedure TMain.Button1Click(Sender: TObject);
    begin
    COBJ_Function;
    end;

    end.
    [/pascal]

  7. #7

    using .obj in delphi

    solved in parts

    now delphi is complaining about a missing those variables
    [pascal]extern unsigned char *wordpointer;
    extern int bitindex;
    [/pascal]

    how i can declare them on delphi?


    edit: if i remove the extern keyword the application trows an access violation when the lib tries access those variables :?
    From brazil (:

    Pascal pownz!

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
  •