View mode: basic / threaded / horizontal-split · Log in · Help
June 20, 2005
Compiling + Linking : please check !
Hey,  I have to ask again. This is in connection to my previous post on compiling and linking.
I'm still not convinced about me making errors in my makefile setup.

So please check this:

If you check in my previous post, the method 2 of compiling modules (which I would like) doest work, but method 1 does.
However, they seem to produce different symbol tables, which to me is surprising, and explains why i get linking error.

Below is the output of the nm on the util/dutil.o module after its been compiled with method 1, followed after its been compiled with
(not-working) method2:

method 1
-----------------------------------------
00000000 D _Class_4util5dutil9ListError
        U _Class_6object5Error
00000000 T _D4util5dutil12newListErrorFAaZv
00000000 T _D4util5dutil5htonlFkZk
00000000 T _D4util5dutil5htonsFtZt
00000000 T _D4util5dutil5ntohlFkZk
00000000 T _D4util5dutil5ntohsFtZt
00000000 T _D4util5dutil9ListError5_ctorFAaZC4util5dutil9ListError
        U _D6object5Error5_ctorFAaZC6object5Error
        U _D6object6Object5opCmpFC6ObjectZi
        U _D6object6Object6toHashFZk
        U _D6object6Object8opEqualsFC6ObjectZi
        U _D6object9Exception5printFZv
        U _D6object9Exception8toStringFZAa
        U _Dmodule_ref
0000003c D _ModuleInfo_4util5dutil			<---- Not defined on method 2
00000010 r _TMP246
00000000 T _array_4util5dutil
00000000 T _assert_4util5dutil
        U _d_array_bounds
        U _d_arraycat
        U _d_assert
        U _d_newclass
        U _d_throw@4
00000018 R _init_4util5dutil9ListError
00000038 R _vtbl_4util5dutil9ListError
        U _vtbl_9ClassInfo
00000000 t gcc2_compiled.
------------------------------------------

method 2
------------------------------------------
00000000 D _Class_4util5dutil9ListError
        U _Class_6object5Error
00000000 T _D4util5dutil12newListErrorFAaZv
00000000 T _D4util5dutil5htonlFkZk
00000000 T _D4util5dutil5htonsFtZt
00000000 T _D4util5dutil5ntohlFkZk
00000000 T _D4util5dutil5ntohsFtZt
00000000 T _D4util5dutil9ListError5_ctorFAaZC4util5dutil9ListError
        U _D6object5Error5_ctorFAaZC6object5Error
        U _D6object6Object5opCmpFC6ObjectZi
        U _D6object6Object6toHashFZk
        U _D6object6Object8opEqualsFC6ObjectZi
        U _D6object9Exception5printFZv
        U _D6object9Exception8toStringFZAa
00000010 r _TMP0
00000060 r _TMP2
00000000 T _array_4util5dutil
00000000 T _assert_4util5dutil
        U _d_array_bounds
        U _d_arraycat
        U _d_assert
        U _d_newclass
        U _d_throw@4
00000018 R _init_4util5dutil9ListError
00000038 R _vtbl_4util5dutil9ListError
        U _vtbl_9ClassInfo
00000000 t gcc2_compiled.
------------------------------------------

So you can see,  D _ModuleInfo_4util5dutil is not defined for method2, and so i get my linker error.
So, err, since the src files are exactly same in both methods of compilation, why is that ? 

Anyone explain this to me, please :)
June 20, 2005
Re: Compiling + Linking : please check !
Denis R wrote:

> Anyone explain this to me, please :)

I just skimmed the previous posts, however I have noticed that if you 
give all files on the command line to DMD, you get different results 
than if you give each file one at a time & then link the .o files.

Ie, calling dmd with 10 .d files in a single command produces different 
(and I have found, broken) results to calling dmd 10 times with 1 .d file.

I don't know if that helps you or not though :)

Brad
June 20, 2005
Re: Compiling + Linking : please check !
In article <d96v7v$18gl$1@digitaldaemon.com>, Brad Beveridge says...
>
>I just skimmed the previous posts, however I have noticed that if you 
>give all files on the command line to DMD, you get different results 
>than if you give each file one at a time & then link the .o files.
>
>Ie, calling dmd with 10 .d files in a single command produces different 
>(and I have found, broken) results to calling dmd 10 times with 1 .d file.
>
>I don't know if that helps you or not though :)

I have experienced problems with this too. I reported it to the bugs forum a
couple of weeks ago but nobody seemed to be able to reproduce it. I had to
rewrite my makefile to use a huge one-line compile command in order to get it to
link. I hope Walter looks into this.

Nick
June 20, 2005
Re: Compiling + Linking : please check !
Nick wrote:
> In article <d96v7v$18gl$1@digitaldaemon.com>, Brad Beveridge says...
> 
>>I just skimmed the previous posts, however I have noticed that if you 
>>give all files on the command line to DMD, you get different results 
>>than if you give each file one at a time & then link the .o files.
>>
>>Ie, calling dmd with 10 .d files in a single command produces different 
>>(and I have found, broken) results to calling dmd 10 times with 1 .d file.
>>
>>I don't know if that helps you or not though :)
> 
> 
> I have experienced problems with this too. I reported it to the bugs forum a
> couple of weeks ago but nobody seemed to be able to reproduce it. I had to
> rewrite my makefile to use a huge one-line compile command in order to get it to
> link. I hope Walter looks into this.
> 
> Nick
> 
> 
Mine was just the opposite, I had to turn a one-line makefile command in 
to a series of single files!  :)

Brad
Top | Discussion index | About this forum | D home