Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to working with *.obj in delphi?

Posted on 2003-11-18
4
Medium Priority
?
3,841 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 500 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

824 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