Re: VC++ .NET 2005 prepending underscore to external functions references
"Jett Gamboa" <jett@discussions.microsoft.com> wrote in message
news:u16VtRzxGHA.3400@TK2MSFTNGP05.phx.gbl...
The source is in C
OK, that's an important bit of information because of the name mangling
issue.
Remember that early on I asked for the dump of the DLL's export table. Your
dump showed that the names of the exports were not decorated. So I built a
DLL with an undecorated export name and a console application with VS2005.
// This is the source to the DLL
void __stdcall Clear_Device_Prn(void)
{
}
// This is the source to its module definition file
LIBRARY Jett
EXPORTS
Clear_Device_Prn
I dumped the export table for the DLL and got this
//-----------------------------------------------------
Microsoft (R) COFF Binary File Dumper Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
Dump of file Jett.dll
File Type: DLL
Section contains the following exports for Jett.dll
0 characteristics
44EDD321 time date stamp Thu Aug 24 12:26:09 2006
0.00 version
1 ordinal base
1 number of functions
1 number of names
ordinal hint RVA name
1 0 000110A5 Clear_Device_Prn
Summary
1000 .data
1000 .idata
2000 .rdata
1000 .reloc
1000 .rsrc
4000 .text
10000 .textbss
//-----------------------------------------------------
Notice that the name of the export displayed by the dump is the same as the
name that you reported.
This is the C source to the console application that calls the function in
the DLL
__declspec(dllimport) void __stdcall Clear_Device_Prn();
int main()
{
Clear_Device_Prn();
return 0;
}
It works like a charm here.
To solve your problem I suggest that you take a similar tack. Start with a
really small console application. Go easy on the headers and macros and turn
of the precompiled header option. Then link. Make sure that works. Then
start adding complexity a little bit at time but only after you get a good
first link.
Regards,
Will