Showing posts with label DLL. Show all posts
Showing posts with label DLL. Show all posts

Friday, February 01, 2008

DLL registration problem

I copied the PushSource Filter.

Push source FIlter has 3 Filters. PushPinBitmap, PushPinBitmapSet and PushPinDesktop.
I removed the code for PushPinBitmap, PushPinBitmapSet .


If I compile the filter, without error it is compiling. But the Problem is while registering the Filter(.ax file), I got the following error.
---------------------------
RegSvr32
---------------------------
DllRegisterServer in D:\PushSource.ax failed. Return code was: 0xc0000005 ( Unrecoverable Error)
---------------------------
OK
---------------------------

So the problem lies in DLL registration part.


CFactoryTemplate g_Templates[3] =
{ { g_wszPushDesktop, // Name

&CLSID_PushSourceDesktop, // CLSID
PushSourceDesktop::CreateInstance, &sudPushSourceDesktop } };

This is Factory template.

Solution :
-------------
I modified the CFactorytemplate array as follows :
CFactoryTemplate g_Templates[] // Note here
= { }

Monday, November 26, 2007

While using CString in a DLL, I got an error Because it is a win32 DLL.

While using CString in a DLL, I got an error Because it is a win32 DLL.

Solution :

I modified the project ->settings->General Tab-> Use MFC in a Shared DLL or Use MFC in a Static Library...

Afterwards I included the #include in "stdafx.h" header file, now the problem is solved...

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.

Friday, November 23, 2007

How to call the DLL from DLL client

For DLL client application :
--------------------------------

1.we have to copy the header file from the DLL application
2.include the library path where the library file resides and copy the library and DLL fucntions
to the application path.
3.we have to include the DLL application's header file in DLL client application and
Call the Function in DLL client application before that