Hello out there! I am trying to build a table of 2 function poiters by using an array: %kernel = alloca [ 2 x int ()* ] I try to access the first pointer to be able to store location of my first function like this: %function_pointer_1 = getelementptr [2 x int ()* ]* %kernel, long 0, long 0 store int ()* %function_1, int ()* %function_pointer_1 But, I get the error message from llvm-asm: llvm-as: 1.ll:40: Can't store 'int () *' into space of type 'int ()'! What is my mistake? Grateful for hints Anders ---------------------------------------------------------------- Anders Alexandersson Masters student at the special year of Software Engineering, HTU Trollhättan E-mail: anders.alexandersson at student.htu.se
On Wed, 31 Mar 2004, Anders Alexandersson wrote:> Hello out there! > > I am trying to build a table of 2 function poiters by using an array: > > %kernel = alloca [ 2 x int ()* ] > > I try to access the first pointer to be able to store location of my first function like this: > > %function_pointer_1 = getelementptr [2 x int ()* ]* %kernel, long 0, long 0 > > store int ()* %function_1, int ()* %function_pointer_1You just need an extra * here: ^ You're storing a pointer through a pointer to pointers... :) -Chris> > But, I get the error message from llvm-asm: > llvm-as: 1.ll:40: Can't store 'int () *' into space of type 'int ()'! > > What is my mistake? > > Grateful for hints > Anders > > ---------------------------------------------------------------- > Anders Alexandersson > Masters student at the special year of Software Engineering, HTU Trollh�ttan > E-mail: anders.alexandersson at student.htu.se > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev >-Chris -- http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/
Yes! :-) What would I do without you folks?! I am the one trying to build a Ruby compiler prototype, so be prepared for more questions...:) Thanks again! Anders ----- Original Message ----- From: "Chris Lattner" <sabre at nondot.org> To: <llvmdev at cs.uiuc.edu> Sent: Wednesday, March 31, 2004 5:49 PM Subject: Re: [LLVMdev] Function pointers On Wed, 31 Mar 2004, Anders Alexandersson wrote:> Hello out there! > > I am trying to build a table of 2 function poiters by using an array: > > %kernel = alloca [ 2 x int ()* ] > > I try to access the first pointer to be able to store location of my firstfunction like this:> > %function_pointer_1 = getelementptr [2 x int ()* ]* %kernel, long 0, long0> > store int ()* %function_1, int ()* %function_pointer_1You just need an extra * here: ^ You're storing a pointer through a pointer to pointers... :) -Chris> > But, I get the error message from llvm-asm: > llvm-as: 1.ll:40: Can't store 'int () *' into space of type 'int ()'! > > What is my mistake? > > Grateful for hints > Anders > > ---------------------------------------------------------------- > Anders Alexandersson > Masters student at the special year of Software Engineering, HTUTrollhättan> E-mail: anders.alexandersson at student.htu.se > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev >-Chris -- http://llvm.cs.uiuc.edu/ http://www.nondot.org/~sabre/Projects/ _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev