www.digitalmars.com         C & C++   DMDScript  

D - D language, Unhandled exception...

reply "mcichon" <m_cichon aol.com> writes:
Hi! I like make programs in Visual Studio (2010). 2 days ago i
want build dll, and when I build default program:


module dllmain;

import std.c.windows.windows;
import core.sys.windows.dll;

__gshared HINSTANCE g_hInst;

extern (Windows)
BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID
pvReserved)
{
      final switch (ulReason)
      {
	case DLL_PROCESS_ATTACH:
	    g_hInst = hInstance;
	    dll_process_attach( hInstance, true );
	    break;

	case DLL_PROCESS_DETACH:
	    dll_process_detach( hInstance, true );
	    break;

	case DLL_THREAD_ATTACH:
	    dll_thread_attach( true, true );
	    break;

	case DLL_THREAD_DETACH:
	    dll_thread_detach( true, true );
	    break;
      }
      return true;
}


My computer sent this error:


Unhandled exception at 0x0040434f in DynamicLib1_test_DDD.dll:
0xC0000005: Access violation reading location 0x00000000.

What I must make???
Aug 21 2012
parent "rst256" <ussr.24 yandex.ru> writes:
On Tuesday, 21 August 2012 at 09:13:51 UTC, mcichon wrote:
 Hi! I like make programs in Visual Studio (2010). 2 days ago i
 want build dll, and when I build default program:


 module dllmain;

 import std.c.windows.windows;
 import core.sys.windows.dll;

 __gshared HINSTANCE g_hInst;

 extern (Windows)
 BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID
 pvReserved)
 {
      final switch (ulReason)
      {
 	case DLL_PROCESS_ATTACH:
 	    g_hInst = hInstance;
 	    dll_process_attach( hInstance, true );
 	    break;

 	case DLL_PROCESS_DETACH:
 	    dll_process_detach( hInstance, true );
 	    break;

 	case DLL_THREAD_ATTACH:
 	    dll_thread_attach( true, true );
 	    break;

 	case DLL_THREAD_DETACH:
 	    dll_thread_detach( true, true );
 	    break;
      }
      return true;
 }


 My computer sent this error:


 Unhandled exception at 0x0040434f in DynamicLib1_test_DDD.dll:
 0xC0000005: Access violation reading location 0x00000000.

 What I must make???

DynamicLib1_test_DDD.dll - you testunit or test.d source i think. has error. some var is null then try to use it. use -debug or -d for get code line.
Oct 20 2014