Solved

How to working with *.obj in delphi?

Posted on 2003-11-18
4
3,826 Views
Last Modified: 2007-12-19
I am a sparetime coder,witch always program some strange tools,
I am pussy of using obj file in delphi.
I googled some articles says these obj file must be COFF format,
But I always can't pass the delphi's check.
I have translated some small c++ modouel to pascal,
now I must use minilzo with my delphi application,
but the minilzo.c has 2936 lines, so I think translate these lines to pascal is foo.
I googled a article gives a unit file to use minilzo.obj,
http://www.howtodothings.com/showarticle.asp?article=402
then I comple minilzo.c use bcc32:
bcc32 -c -WD -a4 -5 -eminilzo.obj minilzo.c

but when I add the lzo.pas into my unit1,The complier show me these messages:

[Error] Lzo.pas(13): Unsatisfied forward or external declaration: 'lzo1x_1_compress'
[Error] Lzo.pas(14): Unsatisfied forward or external declaration: 'lzo1x_decompress'
[Error] Lzo.pas(15): Unsatisfied forward or external declaration: 'lzo1x_decompress_safe'
[Error] Lzo.pas(16): Unsatisfied forward or external declaration: 'lzo_adler32'
[Error] Lzo.pas(17): Unsatisfied forward or external declaration: 'lzo_version'
[Error] Lzo.pas(18): Unsatisfied forward or external declaration: 'lzo_version_string'
[Error] Lzo.pas(19): Unsatisfied forward or external declaration: 'lzo_version_date'
[Fatal Error] MainUnt.pas(43): Could not compile used unit 'lzo.pas'

I change lots arguments of bcc32,but these message always crazy me.
The article's author's email account were closed,and the link he post in article were missed.

these source file avalible here:
http://dangban.nyist.net/pub/gamerip/TestLzo.zip

Could you can help me to resolve the faint problem?

Thx
0
Comment
Question by:azsd
  • 3
4 Comments
 
LVL 2

Accepted Solution

by:
alijunior earned 125 total points
ID: 9770553
Hi...

I downloaded your code and the necessaries changes are as follows:

{$LINK 'minilzo.obj'}

function _lzo1x_1_compress...
function _lzo1x_decompress...
function _lzo1x_decompress_safe...
function _lzo_adler32...
function _lzo_version...
function _lzo_version_string...
function _lzo_version_date...


Type an underscore ("_") character before each name of external procedure in declaration. This is because, for historic reasons, most C compilers still generate C functions with names that start with an underscore. To import them, you'll have to use the "underscored" names. You could tell the C++Builder compiler to omit the underscores, but I normally don't do that. The underscores clearly show that we are using C functions.

If you found some bugs running these procedures, try change the 'stdcall' to 'cdecl' at the end of each declaration.

I wait to have been able to solve its doubt.

0
 

Author Comment

by:azsd
ID: 9770853
Yeah I passed the compiling~~
It's time to go bed in my timezone(China GMT+8) ,I will test whether these passed function's work correct.

Thx,I think I made a native mistake.
0
 

Author Comment

by:azsd
ID: 9770854
Yeah I passed the compiling~~
It's time to go bed in my timezone(China GMT+8) ,I will test whether these passed function's work correct.

Thx,Alijunior
I think I made a native mistake.
0
 

Author Comment

by:azsd
ID: 9771080
after go to sleep,
I test the _lzo_version function,
It works fine.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question