Trouble with static linking

Jarrett Billingsley kb3ctd2 at
Mon Feb 20 18:25:29 PST 2006

"Essoje Oliveira de Almeida" <Essoje_member at> wrote in message 
news:dtdfh1$2qs7$1 at
> And finally this is what I get...
> ******************
> C:\Proj\DDS>dmd dda.d x68sound.lib
> C:\dm\bin\link.exe dda,,,x68sound.lib+user32+kernel32/noi;
> OPTLINK (R) for Win32  Release 7.50B1
> Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
> C:\DMD\BIN\..\lib\phobos.lib(dmain2)
> Error 42: Symbol Undefined _D8X68Sound14X68Sound_StartFiiiiiidZi
> C:\DMD\BIN\..\lib\phobos.lib(dmain2)
> Error 42: Symbol Undefined _D8X68Sound13X68Sound_FreeFZv

Those funny-looking name manglings are D name mangling.  This is because the 
default extern type for functions is extern(D), so DMD mangles those 
exported functions with D mangling.  Try surrounding the contents of the 
X86Sound.d module with an extern(C) block.

Though I'm not entirely sure that will work, as DMD likes to prefix an 
underscore when mangling names to C, and it doesn't look like there are any 
underscores in the def.  Go ahead and try it anyway.  It doesn't look like 
you're using the def file on the commandline, so OPTLINK might like the C 
names in the lib. 

More information about the Digitalmars-d-learn mailing list