Solved

How to working with *.obj in delphi?

Posted on 2003-11-18
4
3,818 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now