summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/add.c10
-rwxr-xr-xsrc/add.h1
-rw-r--r--src/add.obin0 -> 1400 bytes
-rwxr-xr-xsrc/libadd.sobin0 -> 15640 bytes
-rwxr-xr-xsrc/main.c9
-rwxr-xr-xsrc/run.sh8
-rwxr-xr-xsrc/testbin0 -> 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
new file mode 100644
index 0000000..8ddb9e5
--- /dev/null
+++ b/src/add.o
Binary files differ
diff --git a/src/libadd.so b/src/libadd.so
new file mode 100755
index 0000000..003d417
--- /dev/null
+++ b/src/libadd.so
Binary files differ
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
new file mode 100755
index 0000000..8990420
--- /dev/null
+++ b/src/test
Binary files differ