Skip to content
Snippets Groups Projects
Commit 934a1fb4 authored by an7s's avatar an7s
Browse files

test indirect call

Former-commit-id: 2f5069c0654b84f921f3e7de5a7aec9a502b7068
parent c6065cd5
No related branches found
No related tags found
No related merge requests found
......@@ -257,6 +257,7 @@ libIRDB/test/read_variantir.cpp -text
libIRDB/test/rename_function.cpp -text
libIRDB/test/tests/ibtarget/Makefile -text
libIRDB/test/tests/ibtarget/README -text
libIRDB/test/tests/ibtarget/icall.cpp -text
libIRDB/test/tests/ibtarget/jmp.main.cpp -text
libIRDB/test/tests/ibtarget/jmp.shared.cpp -text
libIRDB/test/tests/ibtarget/jmp1.cpp -text
......
#include <stdio.h>
#include <stdlib.h>
int add(int a, int b)
{
printf("%d + %d = %d\n", a, b, a+b);
return a + b;
}
int sub(int a, int b)
{
printf("%d - %d = %d\n", a, b, a-b);
return a - b;
}
int mul(int a, int b)
{
printf("%d * %d = %d\n", a, b, a*b);
return a * b;
}
int main(int argc, char**argv)
{
int (*fn)(int,int);
if (argc % 2)
fn = &add;
else
fn = &sub;
int result = (*fn)(argc, argc+1);
printf("result = %d\n", result);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment