dmd icon indicating copy to clipboard operation
dmd copied to clipboard

importc: cannot use forward declaration of static function when building a library

Open rainers opened this issue 1 month ago • 0 comments

While trying to build phobos as a library with a single call, dmd errors out with

error : no definition found for static `deflate_stored` in this module, statics defined in one module cannot be referenced from another

This boils down to compiling this C code with -lib:

static void static_fun();

void lib_fun()
{
	static_fun();
}

static void static_fun()
{
}

yields:

Error: no definition found for static `static_fun` in this module, statics defined in one module cannot be referenced from another

Also note the missing file and line number.

rainers avatar Nov 28 '25 08:11 rainers