Pyd on Linux building woes

Kirk McDonald kirklin.mcdonald at gmail.com
Tue Aug 8 13:07:15 PDT 2006


Lars Ivar Igesund wrote:
> Kirk McDonald wrote:
> 
> 
>>This is a lengthy one, for which I apologize. I've tried to lay the
>>problem out as best I can, but I am not sure exactly where the problem
>>lies. I am reasonably certain that it is a compilation or linkage
>>problem, and not a problem with the code.
> 
> <snip>
> 
>>It is possible that this is a problem with gdc? Or am I making some
>>stupid mistake?
>>
> 
> 
> No, you don't make any stupid mistakes. I call this a rather bad bug in the
> DMD frontend (which is why it is possible to see it with both compilers). 
> The problem is that the template instances usually don't belong in the
> object/source file of the template itself, but in the client code. Thus the
> same instance (that is, the template is instantiated with the same
> type/parameters), might be needed in several object files. AFAIK, this is
> not handled (or definately not handled correctly) when compiling one by one
> object file, and which is why you won't see any D libs (that is, foo.lib,
> or libfoo.a files) with templates around. However, DMD is able to process
> all the input .d files at once and in this mode it obviously operate
> differently, and when producing the executable, it know everything it needs
> to know about the template instance, and thus it is no longer a problem.

Curses. I was afraid it was something like that. And it seems plain that 
GDC doesn't operate in this mode, for whatever reason, and so the 
problem doesn't go away when I specify the source files all at once.

> 
> So, there a couple of non-perfect options, and the least perfect is not
> generating the symbols at all :P The other is duplicating them over the
> object files that needs the instance, but then the linker usually don't
> know which one to choose. Similar problems can be found with the moduleinfo
> symbols in some cases and when used with libraries. The problems seems to
> be worse on linux, probably because Walter knows better how to use the OMF
> format to the fullest compared to the ELF format.
> 
> There should be quite a few bug reports around concerning both of these
> issues.
> 

I suppose now I will try to find them, and pester Walter about them.

Well, Pyd should be ready with Linux support whenever a compiler is 
available that resolves this problem. The code is now in place for it.

-- 
Kirk McDonald
Pyd: Wrapping Python with D
http://dsource.org/projects/pyd/wiki



More information about the Digitalmars-d mailing list