Hitchikers Guide to Porting Phobos / D Runtime to other architectures

Adam D. Ruppe destructionator at gmail.com
Tue Jan 7 18:22:59 PST 2014


On Wednesday, 8 January 2014 at 02:03:57 UTC, Adam D. Ruppe wrote:
> OK, add -betterC:
>
> Error: TypeInfo not found. object.d may be incorrectly 
> installed or corrupt, compile with -v switch

This is a filthy hack, but it is easy to change this in the 
compiler. (Isn't -betterC a filthy hack in the first place anyway 
:) )

In

Expression *Type::getTypeInfo(Scope *sc)

Add
     if(global.params.betterC)
         return NULL;

right to the top.

And same for struct decl

void TypeInfoStructDeclaration::toDt(dt_t **pdt)
{
     if(global.params.betterC)
         return;


Then it compiles with the struct! ~5 KB executable, two line 
object.d.


....but adding some methods to the struct complain about missing 
ModuleInfo again. Looks like it wants to do assert(this !is 
null); and the assert thing takes a module info reference.

Ugh.... that said, adding:

	void _d_assert_msg() {}
	void _d_assertm() {}
	void* _D4test12__ModuleInfoZ;

to my extern(C) boilerplate did manage to work - structs with 
postblits and dtors yay! - and trimmed the exe down to 1.3K.

Maybe -betterC can stop outputting those references too and then 
we'd really be cooking.


More information about the Digitalmars-d mailing list