Strange name mangling in imported class function

Hi,

I've run into a strange name mangling problem using VC++ 2005 and VC+ 2008.

A given class function (example)

virtual bool OnValueDecrement(CExtGridWnd & wndGrid,
LONG nColNo,LONG nRowNo,INT nColType,INT nRowType);

is being imported as

?OnValueDecrement@CExtGridCell@@UAE_NAAVCExtGridWnd@@JJHH@Z

The third party DLL I'm using here exports this function as

?OnValueDecrement@CExtGridCell@@UAE_NXZ

I suppose this is a compiler/switch issue. Any clues?


0
Schubert1 (1)
10/15/2008 9:21:01 PM
vc.mfc 33608 articles. 0 followers. Follow

7 Replies
839 Views

Similar Articles

[PageSpeed] 25

>I've run into a strange name mangling problem using VC++ 2005 and VC+ 2008.
>A given class function (example)
>
>virtual bool OnValueDecrement(CExtGridWnd & wndGrid,
>LONG nColNo,LONG nRowNo,INT nColType,INT nRowType);
>
>is being imported as
>
>?OnValueDecrement@CExtGridCell@@UAE_NAAVCExtGridWnd@@JJHH@Z
>
>The third party DLL I'm using here exports this function as
>
>?OnValueDecrement@CExtGridCell@@UAE_NXZ

There appears to be a mis-match between what you think the interface
is and what it is.

The undname utility shows:

Undecoration of :-
"?OnValueDecrement@CExtGridCell@@UAE_NAAVCExtGridWnd@@JJHH@Z"

is :- "public: virtual bool __thiscall
CExtGridCell::OnValueDecrement(class CExt
GridWnd &,long,long,int,int)"

Undecoration of :- "?OnValueDecrement@CExtGridCell@@UAE_NXZ"
is :- "public: virtual bool __thiscall
CExtGridCell::OnValueDecrement(void)"

Dave
0
davidl7375 (2060)
10/16/2008 7:07:03 AM
> There appears to be a mis-match between what you think the interface
> is and what it is.
> 
> The undname utility shows:
> 
> Undecoration of :-
> "?OnValueDecrement@CExtGridCell@@UAE_NAAVCExtGridWnd@@JJHH@Z"
> 
> is :- "public: virtual bool __thiscall
> CExtGridCell::OnValueDecrement(class CExt
> GridWnd &,long,long,int,int)"
> 
> Undecoration of :- "?OnValueDecrement@CExtGridCell@@UAE_NXZ"
> is :- "public: virtual bool __thiscall
> CExtGridCell::OnValueDecrement(void)"
> 
> Dave
> 
Dave,

thanks a lot  for your answer. However I'm not sure what it means :-)
The point is that no matter what  compiler/linker settings I'm using I can't 
get my app to import this function as 
"?OnValueDecrement@CExtGridCell@@UAE_NXZ". I wouldn't mind but I can't debug 
it (unknown symbol).

In addition when I compile the third party DLL (sources are available) the 
exported symbol is 
"?OnValueDecrement@CExtGridCell@@UAE_NAAVCExtGridWnd@@JJHH@Z " ( as shown in 
depends.exe). I'm using the makefile delivered with the source code.

Any clues?

Christian
0
10/16/2008 2:43:01 PM
>> There appears to be a mis-match between what you think the interface
>> is and what it is.
>> 
>> The undname utility shows:
>> 
>> Undecoration of :-
>> "?OnValueDecrement@CExtGridCell@@UAE_NAAVCExtGridWnd@@JJHH@Z"
>> 
>> is :- "public: virtual bool __thiscall
>> CExtGridCell::OnValueDecrement(class CExt
>> GridWnd &,long,long,int,int)"
>> 
>> Undecoration of :- "?OnValueDecrement@CExtGridCell@@UAE_NXZ"
>> is :- "public: virtual bool __thiscall
>> CExtGridCell::OnValueDecrement(void)"
>> 
>
>thanks a lot  for your answer. However I'm not sure what it means :-)

Christian,

From what you originally reported, you were apparently using the
function as:

 CExtGridCell::OnValueDecrement(
	class CExt GridWnd &,long,long,int,int)"

whereas the DLL exported it as:

CExtGridCell::OnValueDecrement(void)

However, from what you now say, things are reversed!

>The point is that no matter what  compiler/linker settings I'm using I can't 
>get my app to import this function as 
>"?OnValueDecrement@CExtGridCell@@UAE_NXZ". I wouldn't mind but I can't debug 
>it (unknown symbol).
>
>In addition when I compile the third party DLL (sources are available) the 
>exported symbol is 
>"?OnValueDecrement@CExtGridCell@@UAE_NAAVCExtGridWnd@@JJHH@Z " ( as shown in 
>depends.exe). I'm using the makefile delivered with the source code.

.... so I'm not sure where the mis-match is - other than you presumably
have conflicting definitions between the source used to build the DLL
and the header file you're using to reference the library from your
application.

Dave
0
davidl7375 (2060)
10/16/2008 3:01:26 PM
> 
> Christian,
> 
> From what you originally reported, you were apparently using the
> function as:
> 
>  CExtGridCell::OnValueDecrement(
> 	class CExt GridWnd &,long,long,int,int)"
> 
> whereas the DLL exported it as:
> 
> CExtGridCell::OnValueDecrement(void)
> 
> However, from what you now say, things are reversed!
> 
> >The point is that no matter what  compiler/linker settings I'm using I can't 
> >get my app to import this function as 
> >"?OnValueDecrement@CExtGridCell@@UAE_NXZ". I wouldn't mind but I can't debug 
> >it (unknown symbol).
> >
> >In addition when I compile the third party DLL (sources are available) the 
> >exported symbol is 
> >"?OnValueDecrement@CExtGridCell@@UAE_NAAVCExtGridWnd@@JJHH@Z " ( as shown in 
> >depends.exe). I'm using the makefile delivered with the source code.
> 
> .... so I'm not sure where the mis-match is - other than you presumably
> have conflicting definitions between the source used to build the DLL
> and the header file you're using to reference the library from your
> application.
> 
> Dave
> 

Dave,

in the header file the function is declared as

----------------------------------------

	virtual bool OnValueDecrement(
		CExtGridWnd & wndGrid,
		LONG nColNo,
		LONG nRowNo,
		INT nColType,
		INT nRowType
		);

-------------------------------------

This matches the declaration you expected. This also explains the symbols 
found in the DLL I compiled myself. It does not explain the symbols in the 
precompiled third-party DLL :-(
Are there any compiler switches to modify the way VC decorates the exported 
symbols? IMHO this kind of complex decoration is just a way to accomplish 
some kind of runtime check...

Christian
0
10/21/2008 11:47:02 AM
>...it does not explain the symbols in the precompiled third-party DLL

I can only suggest that you ask the vendor of the library what the
problem is.

>Are there any compiler switches to modify the way VC decorates the exported 
>symbols?

Things like __cdecl and __stdcall will affect the name, as well as
exporting names using .DEF files. See the topic titled "Decorated
Names" in MSDN for a little more information.

> IMHO this kind of complex decoration is just a way to accomplish 
>some kind of runtime check...

Mangling serves to ensure that the linking is correct at build time,
not at run-time.

Dave
0
davidl7375 (2060)
10/21/2008 1:04:33 PM
One question that occurred to me: what version of the compiler was used to create the DLL,
and what version of the compiler is being used to call it?  Could there be a difference in
how the name mangling is done between two compilers?  In the case of third-party software,
was it even the Microsoft compiler?
					joe

On Tue, 21 Oct 2008 14:04:33 +0100, David Lowndes <DavidL@example.invalid> wrote:

>>...it does not explain the symbols in the precompiled third-party DLL
>
>I can only suggest that you ask the vendor of the library what the
>problem is.
>
>>Are there any compiler switches to modify the way VC decorates the exported 
>>symbols?
>
>Things like __cdecl and __stdcall will affect the name, as well as
>exporting names using .DEF files. See the topic titled "Decorated
>Names" in MSDN for a little more information.
>
>> IMHO this kind of complex decoration is just a way to accomplish 
>>some kind of runtime check...
>
>Mangling serves to ensure that the linking is correct at build time,
>not at run-time.
>
>Dave
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
10/21/2008 1:43:31 PM
Hi Joe, Hi Dave,

yes I'm quite sure it was MSVC 8 since the DLL contains some ASCII traces. 
I'm using VC8 as well. I guess that's not the problem.
__stdcall is uses as calling convention here. __cdecl and __fastcall make a 
difference (already tried it) but I never get the same result as in the 
precompiled DLL.
Looks like a DEF file was used in this case (for whatever reason) unless 
someone's got another idea...

Christian

"Joseph M. Newcomer" wrote:

> One question that occurred to me: what version of the compiler was used to create the DLL,
> and what version of the compiler is being used to call it?  Could there be a difference in
> how the name mangling is done between two compilers?  In the case of third-party software,
> was it even the Microsoft compiler?
> 					joe
> 

0
10/21/2008 2:52:01 PM
Reply:

Similar Artilces:

Determing active form to process function
I suppressed the Ctl-P shortcut by creating a ^p autokey macro that does nothing. Now I want Ctl-P to execute a function if a specific form is open and do nothing otherwise. I added a condition to the macro that if the active from is Data Entry ([Screen].[ActiveForm].[Name]="Data Entry"), it should run the function and the next command is StopMacro. The function runs correctly if the active form is Data Entry, but it returns the error "The Object you referenced in the Visual Basic Procedure as an OLE object isn't an OLE Object" if the screen the user is on is ...

AnimateWindow function problem
hi I want to hide my application on certain conditions when the application is minimized. Till now i was using ShowWindow to achieve this and it worked fine. Now when I am using the AnimateWindow API the window gets hidden but the window's entry in the taskbar remains. I am posting the code that i have written. void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == SC_MINIMIZE) { if(bMinimizeToTray) { this->AnimateWindow(200,AW_HIDE |AW_SLIDE | AW_VER_POSITIVE); // this->ShowWindow(SW_HIDE); return; } } CFrameWnd::O...

Initial WorkBook Name
Normally, when Excel starts, the first workbook is named "Book1". If you run a second instance of Excel, you get "Book2" and so on. If you stop the first instance and start a new one, you get "Book1" again. We have a situation where when Excel starts, and there are no other instances running based upon Task Manager, we get things such as Book61, Book4, Book?. How is this initial value determined? Is there something "left" behind from other instances of Excel that could be causing it? Eventually, the system just goes plain crazy and we have ...

Improve Address Functionality
Could we have improved address functionality. The current implementation is so clumsy. The account address is mapped to new contacts on a one off basis, so any amendments to the account address will make potentially hundreds of contacts out of date, and amendments to a contacts address will be missed by the account. Also storing 2 addresses for every account and contact means you end up with a huge number of empty address records. Can we have a normal relationship with the address entity please? -- Marge in the uk ---------------- This post is a suggestion for Microsoft, and Microsoft ...

Does anyone know how I can import Eudora mailbox info into Excel .
I want to be able to import data from Eudora 6.2 into excel or access. But when I go to do so no information in the Eudora end of it shows up. Has anyone run into this before? Any body have a solution? ...

how to : Change organization name
I have exchange 5.5 and did a migration to exchange 2003. It seems we do not have the choice to keep old business name. I NEED TO CHANGE ORGANIZATION NAME. Anybody know how?? Regarding everywhere it seem that i'll have to set a new forest and redo entire network... For example org name was abc.com and now it is must be xyz.com! ABC is our competitors... In message source of every mails we can see old organization name... your only chance to establish the Organization name is at installation...to change it, you do need to reinstall...you can change the display name of the org,...

Must Enter domain name on OWA 2003 Front End?
I noticed two things happen if you do *not* use your domain name when you log onto the OWA 2003 Front End server: 1. When you use the Logout button you get a prompt for your username and password again 2. When you try to open a link within an email message you are prompted for your username and password, and then you must use your domain\username or else the link will never open. Q. Is this because our Internet Mail domain name and our AD domain name are different? I thought the instructions from Microsoft said you could set a default domain, but the options were only for my email domain...

AC 2007 hide column Sort/Filter-Function
Hi, is there any possibility to hide this little arrow at the right side of the column header in tables, query or datasheet views? Thanks for your help Frank On Fri, 14 May 2010 15:32:15 +0200, "Frank Zollinger" <fzollinger@comm-tec.de> wrote: No. -Tom. Microsoft Access MVP >Hi, > >is there any possibility to hide this little arrow at the right side of the >column header in tables, query or datasheet views? > >Thanks for your help >Frank This FAQ page on my site shows you how: http://accessjunkie.com/faq_53.aspx -- J...

Import Contact
I have a CSV file containing a single Contact's details (standard info only- no customisations). I can successfully import this CSV file into one CRM System without any problems. However, importing the same CSV file into a different CRM System gives me the following error message: "You do not have enough privileges to access the Microsoft CRM object or perform the requested operation. For more information, contact your system administrator." I have lowered IE's security permissions to allow ActiveX controls on Local Intranet and confirmed that CRM is running in that zone. ...

Export DN Names To File ...
Hi, I need to export a list of Exchange 2003 mailbox DN names to a file so I can use it with the Exmerge program. The mailboxes are not registered against users in AD as they have been "orphaned" after a migration from Exchange 5.5 & we need to export them to .PST format (to save the data) using Exmerge before deleting them off the stores (there are a thousand to do). I've tried in vain to find a simple tool that will help me do this. Can anyone help. ...

duplicate names in Pivot Table
The more I use Excel, the more surprises I get! I have a Pivot table based on a 16-column data list, one of the columns being "End Uses," say, office machines, laptops, FAX machines, etc., a total of 15 different end uses. Each End use occurs several times in the column. For some reason, two of these end uses, though spelled identically, appear twice on the drop-down list of the table. Any idea how that might have happened? Probably one of the items has a space character at the end, and the other doesn't. K. Georgiadis wrote: > The more I use Excel, the more surpri...

Display name in Active Directory...
I have Exchange 2000 SP3 running Windows 2000 SP4 and using Outlook 2003. I used the ADSI tool to change the display name for my domain users to lastname, firstname. I used the ADModify tool to change all existing accounts Display name to have the new format so ALL my users display name now reads LastName, FirstName in the properites sheet. This gets reflected in GAL so things look good. I only have one problem, when I view the users name in active directory users and computers, the listings shows first name lastname. Is there any tool I can use instead of manually renaming all the existi...

Sercah for attributes within name
Hello I have an SMS report with all the servers. We utilize a naming standard. i.e mail server haf the same 2 lettters within the server name. I want to quickly filter my list to only display i.e. mail servers. How do i filter based on 2 letters within the names? thanks Custom>Contains Gord Dibben MS Excel MVP On Mon, 26 Jan 2009 13:11:44 -0800, Johnsp <Johnsp@discussions.microsoft.com> wrote: >Hello >I have an SMS report with all the servers. We utilize a naming standard. i.e >mail server haf the same 2 lettters within the server name. > >I want to quickly...

Pre-fill a User Name on Onload
I am working with CRM 4.0. I have created a custom entity called Projects and have created a relationship with the User system entity and have named it Editor. I would like to pre-fill the name of a person in the Editor. I am new to java script. Any help will be greatly appreciated. Hi Andy, Following URL is from CRM SDK. It will guide you how to write JScript code for lookup field; http://msdn.microsoft.com/en-us/library/bb928151.aspx -- uMar Khan :: MS CRM MVP Microsoft CRM Consultant Email :: imumar at gmail dot com Blog :: http://umarkhan.wordpress.com MVP :: https://mvp.suppor...

Math Functions in VB
Ok so im doing a project that i need to use a divisor function in but i can not find the code anywhere help would be much appreciated -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200712/1 Why not just write your own in VBA? "jigsaw117 via AccessMonster.com" wrote: > Ok so im doing a project that i need to use a divisor function in but i can > not find the code anywhere > > help would be much appreciated > > -- > Message posted via AccessMonster.com > http://www.accessmonster.com/Uwe/Forums.aspx/acc...

Import information to Excel
I have a link to transfer data from an internet resource into my excel sheet. I can only grab block of information from the webpage. Is there a way to specify the inforation I want instead of having to link the whole block of data? The reason I'm asking is when I link a block, several column of data will be imported to Excel in one column. I use "Text to Columns", but that won't help next time I refresh the data. Thanks. Jason in <get external data> if you want the tables only you can specify. If you want only one table then also you can specify. Only proble...

Summing values in a range Name
Hello, I clicked and dragged a range of numbers and named the range ZERO in the Name Box. I then wanted to perform a Sum of the number in that range and did this: =SUM(ZERO) and it worked, giving me a sum. I wanted to save time copying down a series of Name ranges named (predictably) ZERO,ONE,TWO, THREE, FOUR, etc all the way down to TWENTY-THREE. With the word ZERO in cell A1, the word ONE IN A2 and so on I thought I could go to B1 and enter =SUM(B1) and get results, but that doesn't work. How can an Excel user perform calculations on a series of numbers i...

Windows 2003: Dynamic Filename for Backup Name
Hi, I am looking to schedule a regular backup in Win 2003 using the default backup utility. I would like the name of the backup file to be dynamic, with a date and time stamp. Date is more important than time; If I can get a filename with the date, but without a timestamp, that is fine. For example, today's backup should be Feb_11_2010_6PM_File_Backup, though Feb_11_2010_File_backup will do. Next week's today be Feb_11_2010_5_59PM_File_Backup, etc.. The specific date and timestamp format is not important to me. I am hoping that I can specify a filename such as &l...

Declaring custom OAL functionality via platform SDKs
Hi All, I've been looking for examples of how to intelligently share headers from the PLATFORM directory so that they can be used to build SDK's but seem to be coming up blank... Point in case is that in our Windows CE 6.0 platform we have defined some custom IOCTLS that app programmers will be wanting to use via KernelIoControl() calls to get specific system information. These are typically declared and defined via : _TGTPLATROOT\SRC\INC\ioctl_tab.h _TGTPLATROOT\SRC\INC\ioctl_cfg.h The problem is that the app guys need the IOCTL_* definitions as well and as you...

Counting names
I have a workbook with several worksheets in it. Each worksheet layout is the same. For example: Column A is for a Username Column B is for the User City Column C is for the user State What I would like to do is have another worksheet that will look at all the other worksheets and could how many times the User State of California appears across all of the worksheets. And all the times the city of LA etc, etc, etc How do I do that? thanks in advance. You could use a formula with a reference to each sheet you need: =countif(sheet1!c:c,"california")+countif(sheet2!c:c,"...

Trim function #3
I am joining two columns of data(first and last names) but also need to trim the blank spaces. How is this done? example: col1 col2 smith debra result of join col3 debra smith (with extra spaces) should be debra smith (without the extra spaces) Thanks for your help! Marianne =trim(a2)&" "&trim(a1) **** Hope it helps! **** ~Dreamboat Excel VBA Certification Coming Soon! www.VBAExpress.com/training/ ******************************** "Marianne" <anonymous@discussions.microsoft.com> wrote in message news:021c01c4a64b$cbab84b0$a301280a@phx.gbl......

error
Hi, I am new to excel programming. Want to create a 3D Surface chart. I a using VB 6.0 and Microsoft Excel 9.0 Object Library. Data for the char is in the text file and I don't want to put that data in worksheet Instead I have populated that data in Variant arrays. Three Varian arrays for 3 Axes. But i am getting error for the following code: Set objExcelApp = New Excel.Application Set objExcelWkb = objExcelApp.Workbooks.Add Set objExcelWs = objExcelWkb.Worksheets(1) Set objExcelCht = objExcelWkb.Charts.Add Set objexcelseries1 = objExcelCht.SeriesCollection.NewSerie -- vj ------------...

What about obsolete MakePrivate method functionality in CRM 3.0?
Previous version of CRM (1.2) supported methods MakePrivate and MakePublic for CRM objects. That way, it was possible to hide objects from other users and share them with particular ones. I see that CRM 3.0 does not support these methods any more. Is there a new way to pertain same functionality in CRM 3.0? Any other methods with same functionality? ...

newbie qquestion on named ranges
ms help has very little on the named range box. For example, 1. how can one edit or delete a name in the box? 2. What does it mean, when there is a named range which when selected highlights nothing? Any hints will be appreciated. Ernesto Hi you may take a look at: http://www.xldynamic.com/source/xld.Names.html -- Regards Frank Kabel Frankfurt, Germany "TSH" <mathematicus@yahoo.com> schrieb im Newsbeitrag news:A4ednZskfOA2y1XcRVn-2Q@speakeasy.net... > ms help has very little on the named range box. > For example, > 1. how can one edit or delete a name in the b...

putting a column of names into alphabetical order
I have collected data with names against dates and treatments and wish to rearrange the spreadshett into alphabetical order by name. Some names have spaces in the name column as there may be multiple entries of other date in other columns. I have merged and centred these cells in the "name" column. I still get "cant merge". Have excel2003. maybe I should take my work home and see if 2007 excel can do the job You shouldn't need to merge the cells to sort them. Hopefully you still have an original, unmerged, copy of the data. Simply select all columns w...