OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 23, 2024 5:21 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Object and Library Files and LD
PostPosted: Tue Nov 05, 2002 6:24 am 
Hi,

I am having problems with linking .o and .lib files using LD. If I have a bunch of .o files and I want to put them all in a .lib file it compiles the .lib file properly, but when I try and link it with some code it says that some of the functions are undefined, I know for a fact that they are in the library because I open it in a text editor and check, I have the functions prototyped and it just will not work. If however the .o file is linked directly, everything works properly. It even works if I make the .lib file out of the single .o file, but as soon as I add more than 1 .o file it will not work.

Is there something that I am doing wrong?

thanks.


Top
  
 
 Post subject: Re:Object and Library Files and LD
PostPosted: Tue Nov 05, 2002 6:50 pm 
OK, I have narrowed it down to this, if I create all of my .o files with gcc (ie: c sources) everything goes well, however when I create some with nasm (ie: asm sources) it fails.

So I guess there is a compatability problem between gcc and nasm, has anyone heard of this before, or does any one know where I can find a fix.

Thanks.


Top
  
 
 Post subject: Re:Object and Library Files and LD
PostPosted: Tue Nov 05, 2002 7:27 pm 
there was something I read about loading staticly and dynamicly compiled .lib files need to be supported in your kernel :S :-X


Top
  
 
 Post subject: Re:Object and Library Files and LD
PostPosted: Wed Nov 06, 2002 12:35 am 
LD prefers getting its input object files in the same formats, i think. if you used binutils to convert all of them to COFF or ELF, i doubt LD would complain at all.


Top
  
 
 Post subject: Re:Object and Library Files and LD
PostPosted: Wed Nov 06, 2002 1:19 am 
Hi,

What are the binutils, I have heard of them but I am not sure if I have them, I have Mingw32 so do you know if that comes with it, I dont have a directory called binutils or anything like that so I am not sure.

What particular program actually does this conversion?


Top
  
 
 Post subject: Re:Object and Library Files and LD
PostPosted: Wed Nov 06, 2002 6:40 pm 
the command "objcopy", among other things, is included in binutils and comes with MinGW and most other GCC distributions.

i was referring to using the objcopy command to convert a file:
objcopy -I <in type> -O <out type> <in file> <out file>

type simply "objcopy" to get a full list of available command switches.


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 54 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group