Re: Modules and ld command
From: archibal (glop00.5.archibald_at_spamgourmet.com)
Date: 09/19/03
- Next message: archibal: "Re: Modules and ld command"
- Previous message: Hassan Jafri: "Re: TCP connections dropped"
- In reply to: Kasper Dupont: "Re: Modules and ld command"
- Next in thread: hidave: "Re: Modules and ld command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 19 Sep 2003 16:29:54 GMT
Kasper Dupont wrote:
>>So I can do : ld -r -o SingleModule.o MyModule1.o MyModule2.o
> I don't think you can link two modules that way. Each module would have
> an initialization function, I don't think the final module can have
> multiple initialization functions. You can build a module by linking
> multiple object files with ld, but those object files wouldn't be
> modules themselves.
Ok, in this case the only problem I'll get if I'm doing this is modprobe won't
load the SingleModule.o and will show me some errors, am i right ?
>
>>I would like to know if this last command ( ld ...) will give to me the same
>>result as to have joined the source code of the two modules.
>
>
> Not necesarilly. For example all preprocessing is done independently
> before compiling, so a define in one source file is not going to be
> present when compiling the other.
I don't think I'll get this sort of problems in the way I compile my source but
I've to keep in my mind your pertinent remark.
> Also notice that the scope of static
> functions and variables is the object file. A static function in one
> object file cannot be accessed by the other, that would be possible if
> you joined the sources before compiling.
I would have thought that ld command above would have allow to avoid
this problem so I've to consider that this ld command build one object file
( *.o) from other object files and this one object file is only a concatenation
of object files.
I tried something and the result seems to be not in keeping with what I've just
said :
if the size of MyModule1.o = 1000 and the size of MyModule2.o = 500, the ld
command above don't give me SingleModule.o with a size of 1500, so it's possible
to think that ld doesn't just do a concatenation of MyModule(x).o
If I include the same variable in MyModule1.o and MyModule2.o, the ld command
will stop creating SingleModule.o with an error which is multiple definition of .
.., so again I don't think ld command makes just a concatenation of modules.
I should like to have opinions.
Thanks.
-- Ce message a ete poste via la plateforme Web club-Internet.fr This message has been posted by the Web platform club-Internet.fr http://forums.club-internet.fr/
- Next message: archibal: "Re: Modules and ld command"
- Previous message: Hassan Jafri: "Re: TCP connections dropped"
- In reply to: Kasper Dupont: "Re: Modules and ld command"
- Next in thread: hidave: "Re: Modules and ld command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|