diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/add.c | 10 | ||||
-rwxr-xr-x | src/add.h | 1 | ||||
-rw-r--r-- | src/add.o | bin | 0 -> 1400 bytes | |||
-rwxr-xr-x | src/libadd.so | bin | 0 -> 15640 bytes | |||
-rwxr-xr-x | src/main.c | 9 | ||||
-rwxr-xr-x | src/run.sh | 8 | ||||
-rwxr-xr-x | src/test | bin | 0 -> 19344 bytes |
7 files changed, 28 insertions, 0 deletions
diff --git a/src/add.c b/src/add.c new file mode 100755 index 0000000..0fddbac --- /dev/null +++ b/src/add.c @@ -0,0 +1,10 @@ +/*This c program multiplies two variable values*/
+#include<stdio.h>
+#include <stdlib.h>
+#include "add.h"
+int add(double* answ, double num1, double num2)
+{
+ answ[0] = num1*num2;
+ //printf("Inside add %f \n", answ[0]);
+ return 0;
+}
diff --git a/src/add.h b/src/add.h new file mode 100755 index 0000000..db62457 --- /dev/null +++ b/src/add.h @@ -0,0 +1 @@ +int add(double* answ, double num1, double num2); diff --git a/src/add.o b/src/add.o Binary files differnew file mode 100644 index 0000000..8ddb9e5 --- /dev/null +++ b/src/add.o diff --git a/src/libadd.so b/src/libadd.so Binary files differnew file mode 100755 index 0000000..003d417 --- /dev/null +++ b/src/libadd.so diff --git a/src/main.c b/src/main.c new file mode 100755 index 0000000..6c95040 --- /dev/null +++ b/src/main.c @@ -0,0 +1,9 @@ +#include<stdio.h>
+#include "add.h"
+int main(void)
+{
+ double ar[1];
+ add(ar, 2,5);
+ printf("Inside main %f \n", ar[0]);
+ return 0;
+}
diff --git a/src/run.sh b/src/run.sh new file mode 100755 index 0000000..729b991 --- /dev/null +++ b/src/run.sh @@ -0,0 +1,8 @@ +rm *.o *.so *.lib test + +gcc -fPIC -c add.c +gcc -shared -o libadd.so add.o +gcc -L$(pwd) -Wl,-rpath=$(pwd) -o test main.c -ladd -g + +cp add.h ../thirdparty/linux/include/ +cp libadd.so ../thirdparty/linux/lib/x64/ diff --git a/src/test b/src/test Binary files differnew file mode 100755 index 0000000..8990420 --- /dev/null +++ b/src/test |