15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


AFXEXT linking problems

Matthias Bohlen -- MATTES@logotec.com
Monday, April 15, 1996

Hello, 

I write an MFC extension DLL in Visual C++ 4.0 on an Intel PC.
When I link it, I get the following error messages:

mfcs40d.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already
defined in DLLINIT.OBJ mfcs40d.lib(dllmodul.obj) : error LNK2005:
_DllMain@12 already defined in DLLINIT.OBJ 

mfcs40d.lib(dllmodul.obj) :
warning LNK4006: __pRawDllMain already defined in DLLINIT.OBJ; second
definition ignored 

mfcs40d.lib(dllmodul.obj) : warning LNK4006:
_DllMain@12 already defined in DLLINIT.OBJ; second definition ignored

(note: DLLINIT.OBJ is one of my own files with DllMain() in it, 
including AFXDLLX.H, AfxInitExtensionModule(), 
AfxTerminateExtensionModule() and the like, bells and whistles
like in the DLLHUSK sample project!)

What am I doing wrong?

TIA for responses...
Matthias

-------------------------------------------------------
Matthias Bohlen               Logotec Software GmbH
Phone: +49 228 64 80 520      Chateauneufstr. 10 
FAX:   +49 228 64 80 525      D-53347 Alfter, Germany

E-mail: mattes@logotec.com
-------------------------------------------------------



Dan McNerthney -- mcnerthney@nowmail.nowsoft.com
Thursday, April 18, 1996

I have experenced the same linking problem and traced it
down to the use of the use of 
AFX_MANAGE_STATE(AfxGetStaticModuleState( )
in my exported function.

By replacing AFX_MANAGE_STATE with calls to AfxSetResourceHandle
the link error was resolved and the DLL still loaded it's own resources.

It replace AFX_MANAGE_STATE do something like this:
at the begining of the function:
	// Set default resource to this dll
	HINSTANCE hOldInst = AfxGetResourceHandle();
	AfxSetResourceHandle(DayviewDLL.hResource);

           // do the function stuff...

before returning:
	// Set default resources to the orginal instance
	AfxSetResourceHandle(hOldInst);









| Вернуться в корень Архива |