Oops, fixed #example3_hello_world
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 03 Aug 2015 21:25:56 +0100
changeset 18 6e80a93f4251
parent 17 f49716b8d8c8
child 19 706be0fcef22
Oops, fixed #example3_hello_world Of course, expansion \n is done by the C compiler, not the printf() function... Also fixed return type so function prototype matches the ret insn type.
LLVMExamples.st
--- a/LLVMExamples.st	Mon Aug 03 20:47:52 2015 +0100
+++ b/LLVMExamples.st	Mon Aug 03 21:25:56 2015 +0100
@@ -180,9 +180,9 @@
     printfFunctionType := LLVMType function: #() returning: LLVMType int32.
     printfFunction := module addFunctionNamed: 'printf' type: printfFunctionType.
 
-    helloWorldString := module addGlobalNamed: '.str' value: (LLVMConstant string: 'Hello World!!\n').
+    helloWorldString := module addGlobalNamed: '.str' value: (LLVMConstant string: 'Hello World!!' , Character lf).
 
-    mainFunctionType := LLVMType function: #() returning: LLVMType intptr.
+    mainFunctionType := LLVMType function: #() returning: LLVMType int32.
     mainFunction := module addFunctionNamed: 'main' type: mainFunctionType.
 
     mainFunctionEntry := mainFunction addBasicBlockNamed: 'entry'.