Solved

How to working with *.obj in delphi?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using FastMM4... should I enable MMX option? 9 76
Delphi OLE Error 8 95
LAN or WAN ? 11 82
Delphi inherited method 6 63
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

16 Experts available now in Live!

Get 1:1 Help Now