How to get normal DLL method name

Denis Mezhov d.o.mezhov at gmail.com
Sat Feb 15 15:55:43 PST 2014


DLL

module dllmain;

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

__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;
}

export void dllprint()
{
	printf("hello dll world\n");	
}

In Main

FARPROC fp = GetProcAddress(h, "dllmain");  // Not work
if fp is null)
{
    printf("error loading symbol()\n");
}


FARPROC fp = GetProcAddress(h, "D7dllmain8dllprintFZv"); // It 
work
if fp is null)
{
    printf("error loading symbol()\n");
}

How i set/get normal name in DLL?







More information about the Digitalmars-d-learn mailing list