Displaying 2 results from an estimated 2 matches for "cgktype".
Did you mean:
cfg_type
2011 Jun 20
3
[LLVMdev] C struct as function argument
...def struct _test_struct {
int x;
int y;
} test_struct;
id testLLVMStructFuncCall(test_struct x) {
NSLog(@"%d %d",x.x,x.y);
return N(x.x + x.y);
}
-(void) testLLVMStructFuncCall {
CGKModule* myMod = [CGKModule moduleWithName:@"llvm_structfunccall_test"];
CGKType* testStructType = [CGKType structTypeWithElementTypes:[NSArray arrayWithObjects:[CGKType intTypeWith32Bits],[CGKType intTypeWith32Bits],nil]];
CGKFunction* lfunc = [CGKFunction functionWithName:@"testLLVMStructFuncCall" types:[NSArray arrayWithObjects:[CGKType idType],testStructType,n...
2011 Jun 20
0
[LLVMdev] C struct as function argument
Hello Michael,
> The module dump suggests everything is right, i can see in the function call the struct with the values 10 and 25, but the function is only received the 10 for the x field, nothing for the y field. Am I missing something?
You're missing the Platform ABI. I assume you're on x86-64, then your
struct (according to the ABI) should be passed in a single 64 bit
register as