[LLVMbugs] [Bug 6680] New: A dynamic link library (DLL) initialization routine failed.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 22 20:17:25 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=6680

           Summary: A dynamic link library (DLL) initialization routine
                    failed.
           Product: tools
           Version: 2.6
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Keywords: miscompilation
          Severity: release blocker
          Priority: P
         Component: llvm-gcc
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: ga55gees6m at sneakemail.com
                CC: llvmbugs at cs.uiuc.edu


--- tdll.c ---
#define UNICODE

#include <windows.h>

int f(void)
{
    return 0;
}

__stdcall BOOL DllMain(HINSTANCE hInst, DWORD reason, void *reserved)
{
    OutputDebugString(L"dll: 123");
    return TRUE;
}

void g(const WCHAR *msg)
{
    OutputDebugString(msg);
}
---
>llvm-gcc.exe -c tdll.c -o tdll.o -pipe -Wall

>ld --dll --subsystem windows -Bdynamic -nostdlib -
o tdll.dll tdll.o -L\pr\llvm\lib -lkernel32 -luser32 -s --fatal-warnings
--error
-unresolved-symbols

>test
---
test is a simple testing application which loads library and gets error
--- test.c ---
#define UNICODE
#include <windows.h>

void TraceError(void)
{
    WCHAR str[300];
    DWORD err=GetLastError();
    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,err,LANG_USER_DEFAULT,str,300,NULL);
    OutputDebugString(str);
}

int main()
{
    HMODULE m=LoadLibrary(L"tdll.dll");
    if(m)OutputDebugStringW(L"test: ok");
    else { OutputDebugStringW(L"test: fail"); TraceError(); }
    return 0;
}
---
Error: A dynamic link library (DLL) initialization routine failed. 
---
Interestingly, reordering functions in tdll.c yields different results - from
failure to success, optimization makes situation even worse. This is a reduced
testcase from miranda plugin project. I wondered, why miranda doesn't display
my plugin. It turned out dll built with llvm-gcc fails to initialize.
Blocker, can't work it around.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list