Export static data

Sergey Gromov snake.scaly at gmail.com
Sat Aug 22 16:57:12 PDT 2009


Fri, 21 Aug 2009 12:01:48 -0400, Jarrett Billingsley wrote:

> On Fri, Aug 21, 2009 at 11:10 AM, Dan<Dan.R.Stevens at gmail.com> wrote:
>> Another issue I had was with the name decoration. I need to be able
>> to export an "InitProc". The closest I was able to get was
>> "_InitProc" and "INITPROC". Is there a way to drop the leading
>> underscore?
> 
> As far as I know, not within the language.  DMD for some reason thinks
> that all Windows functions are preceded by an underscore when that is
> clearly not the case.  You might be able to do something using a .def
> file (linker script), but I've only had experience linking external
> symbols in, not with exporting internal symbols.

All Windows functions are __stdcall, and that implies a name mangling
scheme, _name at SizeOfArguments.  This is Microsoft's mangling scheme, it
is respected in their .obj files and import libraries.  But they decided
not to follow it in system DLL exported symbol names for some reason.
You overcome this peculiar design decision with .def files both with
Microsoft toolchain and with DMD.


More information about the Digitalmars-d-learn mailing list