summaryrefslogtreecommitdiff
path: root/examples/hello_cxx
diff options
context:
space:
mode:
authorAndrew Shadura <andrew@shadura.me>2015-07-25 14:44:48 +0200
committerAndrew Shadura <andrew@shadura.me>2015-07-25 14:44:48 +0200
commit8d15cbf39b8aa01eaabfa3167e6ce3dc9f9e0af8 (patch)
tree285bc54cde407bc53e4134c649569b92758ed33a /examples/hello_cxx
parent6ec061aabc159e3f37591e92fa1df407cdca6246 (diff)
Imported Upstream version 0.27.0
Diffstat (limited to 'examples/hello_cxx')
-rw-r--r--examples/hello_cxx/Makefile2
-rw-r--r--examples/hello_cxx/expect.out24
-rw-r--r--examples/hello_cxx/five.c6
-rw-r--r--examples/hello_cxx/five.h14
-rw-r--r--examples/hello_cxx/main.cc6
-rw-r--r--examples/hello_cxx/seven.c6
-rw-r--r--examples/hello_cxx/seven.h14
7 files changed, 71 insertions, 1 deletions
diff --git a/examples/hello_cxx/Makefile b/examples/hello_cxx/Makefile
index f9a1a11..be0460d 100644
--- a/examples/hello_cxx/Makefile
+++ b/examples/hello_cxx/Makefile
@@ -4,7 +4,7 @@ WARNS = 4
CPPFLAGS += -I.
-SRCS = hello_msg.cc main.cc
+SRCS = main.cc hello_msg.cc five.c seven.c
MKC_REQD = 0.12.9
diff --git a/examples/hello_cxx/expect.out b/examples/hello_cxx/expect.out
index 626ff9f..2d97290 100644
--- a/examples/hello_cxx/expect.out
+++ b/examples/hello_cxx/expect.out
@@ -1,11 +1,20 @@
Hello world!
+Five: 5
+Seven: 7
=========== all ============
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
/objdir/expect.out
+/objdir/five.c
+/objdir/five.h
+/objdir/five.o
/objdir/hello_cxx
/objdir/hello_cxx.test.out.tmp
/objdir/hello_msg.cc
@@ -13,6 +22,9 @@ Hello world!
/objdir/hello_msg.o
/objdir/main.cc
/objdir/main.o
+/objdir/seven.c
+/objdir/seven.h
+/objdir/seven.o
/objdir/test.mk
========= install ==========
/objdir/prefix
@@ -21,21 +33,33 @@ Hello world!
======== uninstall =========
========== clean ===========
/objdir/Makefile
+/objdir/_mkc_compiler_type.err
+/objdir/_mkc_compiler_type.res
/objdir/_mkc_cxx_type.err
/objdir/_mkc_cxx_type.res
+/objdir/_mkc_prog_cc.err
+/objdir/_mkc_prog_cc.res
/objdir/_mkc_prog_cxx.err
/objdir/_mkc_prog_cxx.res
/objdir/expect.out
+/objdir/five.c
+/objdir/five.h
/objdir/hello_cxx.test.out.tmp
/objdir/hello_msg.cc
/objdir/hello_msg.h
/objdir/main.cc
+/objdir/seven.c
+/objdir/seven.h
/objdir/test.mk
======= distclean ==========
/objdir/Makefile
/objdir/expect.out
+/objdir/five.c
+/objdir/five.h
/objdir/hello_cxx.test.out.tmp
/objdir/hello_msg.cc
/objdir/hello_msg.h
/objdir/main.cc
+/objdir/seven.c
+/objdir/seven.h
/objdir/test.mk
diff --git a/examples/hello_cxx/five.c b/examples/hello_cxx/five.c
new file mode 100644
index 0000000..1b2f63f
--- /dev/null
+++ b/examples/hello_cxx/five.c
@@ -0,0 +1,6 @@
+#include "five.h"
+
+int five (void)
+{
+ return 5;
+}
diff --git a/examples/hello_cxx/five.h b/examples/hello_cxx/five.h
new file mode 100644
index 0000000..51f786b
--- /dev/null
+++ b/examples/hello_cxx/five.h
@@ -0,0 +1,14 @@
+#ifndef _FIVE_H_
+#define _FIVE_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int five (void);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // _FIVE_H_
diff --git a/examples/hello_cxx/main.cc b/examples/hello_cxx/main.cc
index 4b93a98..1d99736 100644
--- a/examples/hello_cxx/main.cc
+++ b/examples/hello_cxx/main.cc
@@ -1,7 +1,13 @@
#include "hello_msg.h"
+#include "five.h"
+#include "seven.h"
+
+#include <iostream>
int main (int argc, char **argv)
{
hello_msg ();
+ std::cout << "Five: " << five () << '\n';
+ std::cout << "Seven: " << seven () << '\n';
return 0;
}
diff --git a/examples/hello_cxx/seven.c b/examples/hello_cxx/seven.c
new file mode 100644
index 0000000..1e4316a
--- /dev/null
+++ b/examples/hello_cxx/seven.c
@@ -0,0 +1,6 @@
+#include "seven.h"
+
+int seven (void)
+{
+ return 7;
+}
diff --git a/examples/hello_cxx/seven.h b/examples/hello_cxx/seven.h
new file mode 100644
index 0000000..34c3642
--- /dev/null
+++ b/examples/hello_cxx/seven.h
@@ -0,0 +1,14 @@
+#ifndef _SEVEN_H_
+#define _SEVEN_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int seven (void);
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif // _SEVEN_H_