GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 01-Nov-2006, 11:16
emanresu emanresu is offline
New Member
 
Join Date: Nov 2006
Location: Essex, UK. (Near London)
Posts: 24
emanresu is on a distinguished road

Linking more than one object


Hi,
Brief background...I am not a trained C programmer but am the poor soul left to update legacy C programs. One particular program requires use of BTRV API (instead of Scaleable SQL API) due to impending upgrade to Btrieve 8. The C compiler is Microsoft version 6.00A and the Linker is version 5.10.

My first problem is understanding the correct syntax for linking two objects?

The procedure I use is to open a DOS window, run a batch file that sets up the path, includes, etc. and then run a batch file that does the compile and link.

Firstly, I compile btrapi.c (compile only) to create btrapi.obj using this:
cl -c /AM /Zp /Od btrapi.c
This works fine, as far as I can tell, apart from three name truncation warning messages.

Then I compile and link the application program. Originally, when just one object, I used this supplied batch file :
cl -c /AM /Zp /Od xxxxxx.c
link xxxxxx.obj, xxxxxx.exe,, xqlintf.lib, /ST:10240 /NOE
[Note, I have masked the application name].

Now, with the additional object, I have tried variations such as
cl -c /AM /Zp /Od icrsex1a.c
link xxxxxx.obj, btrapi.obj, xxxxxx.exe,, xqlintf.lib, /ST:10240 /NOE
or
cl -c /AM /Zp /Od icrsex1a.c
link xxxxxx.obj btrapi.obj, xxxxxx.exe,, xqlintf.lib, /ST:10240 /NOE
but
get errors. I'll post the errors later, once I know and have tried the correct link method.

Many Thanks....
  #2  
Old 01-Nov-2006, 11:59
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,893
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Linking more than one object


Quote:
Originally Posted by emanresu
Hi,

My first problem is understanding the correct syntax for linking two objects?

The procedure I use is to open a DOS window, run a batch file that sets up the path, includes, etc. and then run a batch file that does the compile and link.

Firstly, I compile btrapi.c (compile only) to create btrapi.obj using this:
cl -c /AM /Zp /Od btrapi.c
This works fine, as far as I can tell, apart from three name truncation warning messages.

I just use cl for everything:

Using defaults (for compiler and linker options):

1. cl -c btrapi.c gives btrapi.obj
2. cl -c xxxxxx.c gives xxxxxx.obj
3. cl xxxxxx.obj btrapi.obj gives xxxxxx.exe (unless there are linker errors like undefined variables/functions or multiply defined variables, etc.)

If you need extra linker options and libraries use /link on the cl command line, and you can pass them as follows:

cl xxxxxx.obj btrapi.obj /link /STACK:10240 /NOENTRY


I don't see why you couldn't use the link command by itself, but, depending on the version of link you have, it may not recognize "/ST" for "/STACK" and "/NOE" for "/NOENTRY". If I just enter "link" without any arguments it gives me a list of options. (Part of bewhiskered Visual Studio version 6.)

Regards,

Dave
  #3  
Old 01-Nov-2006, 12:09
emanresu emanresu is offline
New Member
 
Join Date: Nov 2006
Location: Essex, UK. (Near London)
Posts: 24
emanresu is on a distinguished road

Re: Linking more than one object


Thanks Dave,
I'll try that out tomorrow as it's gone home time here!

Cheers,
Bob
  #4  
Old 01-Nov-2006, 12:18
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,893
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: Linking more than one object


Quote:
Originally Posted by emanresu
Thanks Dave,
I'll try that out tomorrow as it's gone home time here!

Cheers,
Bob

If by /NOE, you meant /NOENTRY, What's up with that? Is the target file .exe or .dll? (Just curious.)

Regards,

Dave
  #5  
Old 02-Nov-2006, 04:22
emanresu emanresu is offline
New Member
 
Join Date: Nov 2006
Location: Essex, UK. (Near London)
Posts: 24
emanresu is on a distinguished road

Re: Linking more than one object


Quote:
Originally Posted by davekw7x
If by /NOE, you meant /NOENTRY, What's up with that? Is the target file .exe or .dll? (Just curious.)

/NOE means no extended dictionaries

This prevents extended library searches which sometimes cause
errors whilst linking
  #6  
Old 02-Nov-2006, 04:57
emanresu emanresu is offline
New Member
 
Join Date: Nov 2006
Location: Essex, UK. (Near London)
Posts: 24
emanresu is on a distinguished road
Thumbs up

Re: Linking more than one object


OK, first try was
cl icrsex1a.obj btrapi.obj xqlintf.lib

This gave me....
Microsoft (R) Segmented-Executable Linker Version 5.10
Copyright (C) Microsoft Corp 1984-1990. All rights reserved.

Object Modules [.OBJ]: icrsex1a.obj +
Object Modules [.OBJ]: "btrapi.obj" /farcall
Run File [icrsex1a.exe]: "icrsex1a.exe" /noi
List File [NUL.MAP]: NUL
Libraries [.LIB]: "xqlintf.lib"
Definitions File [NUL.DEF]: ;

I think it may have worked!
Will have to test program out now, will let you know.
 
 

Recent GIDBlogPython ebook by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Use of HttpWebRequest object dattaforit .NET Forum 1 08-Oct-2006 06:29
Please Help Me To Build My Calendar!!! suriacute85 Java Forum 0 05-Oct-2006 20:39
overloading operators in a class. fevershark C++ Forum 11 22-Feb-2006 20:34
How do I access an object from inside another object? JdS MySQL / PHP Forum 5 10-Jun-2003 09:51

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 07:14.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.