Page 1 of 1

Eroare R6033

Posted: 04 Jul 2008, 14:09
by ionnoi
Am creat un MFC Extension DLL care e builduit cu /clr pt. ca folosesc in el niste componente .NET. Acest DLL il folosesc intr-o aplicatie (MFC desigur). In momentul in care mi se incarca DLL-ul, aparare o eroare, R6033.
Attempt to use MSIL code from this assembly during native code initialization. This indicates a bug in your application. It is most likely the result of calling an MSIL-compiled (/clr) function from a native constructor or from DllMain.
Dupa cum se vede mai jos nu fac nici un apel la ceva code .NET in DllMain, si e marcat unmanaged cu un #pragma, asa cum e explicat aici.

Code: Select all

#include "stdafx.h"
#include <afxwin.h>
#include <afxdllx.h>

#ifdef _DEBUG
#define new DEBUG_NEW


#pragma unmanaged
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
	// Remove this if you use lpReserved

	if (dwReason == DLL_PROCESS_ATTACH)
		TRACE0("Test.DLL Initializing!\n");
		// Extension DLL one-time initialization
		if (!AfxInitExtensionModule(TestDLL, hInstance))
			return 0;

		// Insert this DLL into the resource chain
		// NOTE: If this Extension DLL is being implicitly linked to by
		//  an MFC Regular DLL (such as an ActiveX Control)
		//  instead of an MFC application, then you will want to
		//  remove this line from DllMain and put it in a separate
		//  function exported from this Extension DLL.  The Regular DLL
		//  that uses this Extension DLL should then explicitly call that
		//  function to initialize this Extension DLL.  Otherwise,
		//  the CDynLinkLibrary object will not be attached to the
		//  Regular DLL's resource chain, and serious problems will
		//  result.

		new CDynLinkLibrary(TestDLL);

	else if (dwReason == DLL_PROCESS_DETACH)
		TRACE0("Test.DLL Terminating!\n");

		// Terminate the library before destructors are called
	return 1;   // ok
Stie cineva cum se poate rezolva problema?

Re: Eroare R6033

Posted: 04 Jul 2008, 14:59
by Marius Bancila
E explicat in MSDN cum se face: ... S.80).aspx.

Din experiente, nu merge exact ca acolo. In fisierul care contine DllMain nu include stdafx.h si specfica pt. el ca nu foloseste Precompiled Headers si o sa mearga.

Re: Eroare R6033

Posted: 04 Jul 2008, 16:08
by ionnoi
Se pare ca merge. :yahoo: Mersi de link.

Re: Eroare R6033

Posted: 03 Aug 2009, 14:14
by matheszabi
Am si eu eroarea asta si tare doresc sa ma scap de el.

Am un (mai multe) .dll C++ native, care se compileaza forte frumos.
Am creat niste clase wrapper pt acele clase native sa fie expusa catre dotnet. Astea sunt Win32 app emty project cu optiunea de /clr, si linkat ca dll.
Ca sa folosesc / testez aceste wrapere am cread windows user controls in C#, tot dll -uri.

Mesajul asta dragalas imi da visual studioul 2008 in timp de rebuild.
Am optiunea de Abort, Retry, Ignore

Daca dau Retry im-i dispare IDE ul doar pla process viewer o mai vad.
Daca dau Ignore, atunci inca o data vine aceast code de mesaj din partea de Visual C++ Library.

Ce sa fac sa pot compila? -rebuild, daca dau unu cite nul buil la cele 17 proiecte nu o sa fac nimic toata ziua :(

Re: Eroare R6033

Posted: 03 Aug 2009, 15:25
by matheszabi
Daca debifez: register for COM interop,atunci am scapat, dar am nevoie de ala...
Any help?