Displaying 2 results from an estimated 2 matches for "callputchar".
2013 Dec 08
0
[LLVMdev] Win32: Crash in DLL created by llvm that calls into the "putchar" function
...reproduce a crash in code that has been
generated by llvm. The code calls into the "putchar" function from
LIBCMT.LIB. It works when creating an .exe file, but not when creating
a .dll file and calling into an exported function.
First, let me show how the code works as an .exe:
> cat callPutchar.ll
; ModuleID = 'test'
declare i32 @putchar(i32)
define i32 @main() {
__entry__:
%0 = call i32 @putchar(i32 79)
ret i32 %0
}
> lli callPutchar.ll ; Test, whether the code itself works. Output is as expected an 'O' (ASCII 79):
O
> llc -filetype obj callPutchar.ll ; Crea...
2013 Dec 08
1
[LLVMdev] Win32: Crash in DLL created by llvm that calls into the "putchar" function
Hey Jeremy,
(putting the discussion back to the list.)
2013/12/8 Jeremy Lakeman <Jeremy.Lakeman at gmail.com>:
> If I run your demo exe it crashes, if I re-link the dll with VS 2010 it
> errors gracefully;
>
> runtime error R6030
> - CRT not initialized
>
> putchar is a c runtime function.
> I'm betting that your exe doesn't initialise the runtime library?