Monday, November 26, 2007

How to Avoid name mangling of a function in a DLL:

How to Avoid name mangling of a function in a DLL:

I opened my DLL using Dependency viewer in visual studio tools.

The Dependency viewer showed the functions in it as follows :

For AAPI_CleanupRecorder() fn, it displays as follows :

?AAPI_CleanupRecorder@@YGHXZ

This is called name mangling.ToSupport function overloading this will happen.
How can we disable name mangling ?...


Solution :
------------

we can avoid name mangling using .def file in a DLL.

I added the AAPI_CleanupRecorder() fn in a .Def file as follows :


LIBRARY AAPIPC2TV.dll

EXPORTS

AAPI_CleanupRecorder @1

I compiled the DLL and then once again opened the DLL in a "Dependency viewer".

Now the AAPI_CleanupRecorder function is available in a Dependency viewer as follows :


AAPI_CleanupRecorder

But the Demerit of this approach is we can't use the function overlaoding.

Labels: ,

0 Comments:

Post a Comment

<< Home