view dmd/codegen/linkhelper.d @ 191:52188e7e3fb5

Fixed deprecated features, now compiles with DMD2.058 Also changed Array allocation policy: Now doesn't reallocate but malloc's, followed by a memcpy (no free). (this fixes a crash while compiling druntime. Same bug in dmd)
author korDen@korDen-pc
date Sun, 25 Mar 2012 03:11:12 +0400
parents b64060ab22df
children
line wrap: on
line source

module dmd.codegen.linkhelper;

import dmd.Loc;
import dmd.Util;

import core.stdc.stdarg;
import std.conv;

// help resolve some linker dependencies from the backend back into the frontend

extern(C++)
{
	// msc.c wants to access global from out_config_init(), but it should never be called
	struct Global {}
	__gshared Global global;

	void error(const char *filename, uint linnum, const char *format, ...)
	{
		Loc loc;
		loc.filename = to!string(filename);
		loc.linnum = linnum;

		va_list ap;
		va_start(ap, format);
		
		char buf[1024];
		int len = vsprintf(buf.ptr, format, ap);
		va_end( ap );
		
		dmd.Util.error(loc, buf[0..len].idup);
	}
}