dynamic library building and loading

Iain Buclaw ibuclaw at ubuntu.com
Fri Sep 28 05:31:14 PDT 2012


On 28 September 2012 12:14, Johannes Pfau <nospam at example.com> wrote:
> Am Fri, 28 Sep 2012 02:04:11 +0200
> schrieb "Rob T" <rob at ucora.com>:
>
>>
>> So if I read this right, I can build phobos/druntime with -fPIC
>> from the source code and it will work OK? If so, then why was
>> this not done with the latest distrubution package, or is this
>> only possible after a certain version number?
>>
>> --rt
>
> It shouldn't compile on x86 (32bit) with -fPIC because there's some
> incompatible asm code in druntime and phobos. If dmd doesn't warn in
> these cases, this code will fail as soon as it's called.
>
> GDC used to warn about these errors, but as we dropped the D inline
> assembler that code doesn't affect us anymore and there are no more
> warnings.
>
> The fix for this issue is simple: Do not modify the EBX register, or at
> least save & restore it.
>

In GDC D1 phobos, one hack around it was to use db to manually write
out the bytecode instruction (thus bypassing GCC 'ebx' clobbered
checks).  Which was a fiendish workaround to say the least. :~)


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list