Eroare R6033

Intrebari despre limbajul C++/CLI (si versiunile mai vechi MC++), applicatii mixed-mode sau probleme specifice .NET legate de C++.
Post Reply
ionnoi
Junior
Junior
Posts: 9
Joined: 04 Jul 2008, 14:03

Eroare R6033

Post by ionnoi » 04 Jul 2008, 14:09

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
#endif

static AFX_EXTENSION_MODULE TestDLL = { NULL, NULL };

#pragma unmanaged
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
	// Remove this if you use lpReserved
	UNREFERENCED_PARAMETER(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
		AfxTermExtensionModule(TestDLL);
	}
	return 1;   // ok
}
Stie cineva cum se poate rezolva problema?



User avatar
Marius Bancila
Fondator
Fondator
Posts: 2344
Joined: 11 Jul 2007, 11:45
Judet: Timiş
Location: Timisoara
Contact:

Re: Eroare R6033

Post by Marius Bancila » 04 Jul 2008, 14:59

E explicat in MSDN cum se face: http://msdn.microsoft.com/en-us/library ... 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.
Marius Bancila
Fondator Codexpert, Microsoft MVP VC++
Site personal | Blog

ionnoi
Junior
Junior
Posts: 9
Joined: 04 Jul 2008, 14:03

Re: Eroare R6033

Post by ionnoi » 04 Jul 2008, 16:08

Se pare ca merge. :yahoo: Mersi de link.

matheszabi
Junior
Junior
Posts: 2
Joined: 03 Aug 2009, 14:05
Judet: Mureş

Re: Eroare R6033

Post by matheszabi » 03 Aug 2009, 14:14

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 :(

matheszabi
Junior
Junior
Posts: 2
Joined: 03 Aug 2009, 14:05
Judet: Mureş

Re: Eroare R6033

Post by matheszabi » 03 Aug 2009, 15:25

Daca debifez: register for COM interop,atunci am scapat, dar am nevoie de ala...
http://www.databaseforum.info/29/986254.aspx
Any help?

Post Reply