aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <[email protected]>2012-12-02 16:57:17 +0900
committerMITSUNARI Shigeo <[email protected]>2012-12-02 16:57:17 +0900
commitd548d02e2c9def7c728db2edbc5477a9e41cedbc (patch)
treeb4cab8e78fadf9c7419b8e2008fd8c89597f1d9e /test
parent6f57b3cf03d6fb336af85b123e6348863a9ae849 (diff)
downloadxbyak-d548d02e2c9def7c728db2edbc5477a9e41cedbc.tar.gz
xbyak-d548d02e2c9def7c728db2edbc5477a9e41cedbc.zip
add lib test
Diffstat (limited to 'test')
-rw-r--r--test/Makefile6
-rw-r--r--test/lib_run.cpp9
-rw-r--r--test/lib_test.cpp17
3 files changed, 32 insertions, 0 deletions
diff --git a/test/Makefile b/test/Makefile
index 27075ee..cffcd92 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -49,6 +49,12 @@ test_avx: normalize_prefix
clean:
rm -rf *.o $(TARGET)
+lib_test.a: lib_test.cpp
+ $(CXX) -c $(CFLAGS) lib_test.cpp
+ ar r lib_test.a lib_test.o
+
+lib_run: lib_test.a lib_run.cpp
+ $(CXX) $(CFLAGS) lib_run.cpp lib_test.a -o lib_run
make_nm: make_nm.cpp $(XBYAK_INC)
diff --git a/test/lib_run.cpp b/test/lib_run.cpp
new file mode 100644
index 0000000..d1e1127
--- /dev/null
+++ b/test/lib_run.cpp
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+int ret123();
+
+int main()
+{
+ printf("ret=%d\n", ret123());
+}
+
diff --git a/test/lib_test.cpp b/test/lib_test.cpp
new file mode 100644
index 0000000..399d1fa
--- /dev/null
+++ b/test/lib_test.cpp
@@ -0,0 +1,17 @@
+#include <xbyak/xbyak.h>
+
+struct Code : public Xbyak::CodeGenerator {
+ Code()
+ {
+ mov(eax, 5);
+ ret();
+ }
+};
+
+int ret123()
+{
+ static Code code;
+ int (*f)() = (int (*)())code.getCode();
+ return f();
+}
+