Check C++ compatibility for some internal headers that may (now or in
authorKen Raeburn <raeburn@mit.edu>
Mon, 9 Feb 2009 16:36:09 +0000 (16:36 +0000)
committerKen Raeburn <raeburn@mit.edu>
Mon, 9 Feb 2009 16:36:09 +0000 (16:36 +0000)
the future) be used in C++ code on Windows.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21919 dc483132-0cff-0310-8789-dd5450dbe970

src/tests/misc/Makefile.in
src/tests/misc/test_cxx_k5int.cpp [new file with mode: 0644]

index 811d12282a577a7a3a53252443b06e538d719efd..1cf2c9e6b0cb8e694d200cac36d7bc902c1fb740 100644 (file)
@@ -11,14 +11,16 @@ SRCS=\
        $(srcdir)/test_getpw.c \
        $(srcdir)/test_getsockname.c \
        $(srcdir)/test_cxx_krb5.cpp \
+       $(srcdir)/test_cxx_k5int.cpp \
        $(srcdir)/test_cxx_gss.cpp \
        $(srcdir)/test_cxx_rpc.cpp
 
 all:: test_getpw
 
-check:: test_getpw test_cxx_krb5 test_cxx_gss test_cxx_rpc
+check:: test_getpw test_cxx_krb5 test_cxx_gss test_cxx_rpc test_cxx_k5int
        $(RUN_SETUP) $(VALGRIND) ./test_getpw
        $(RUN_SETUP) $(VALGRIND) ./test_cxx_krb5
+       $(RUN_SETUP) $(VALGRIND) ./test_cxx_k5int
        $(RUN_SETUP) $(VALGRIND) ./test_cxx_gss
        $(RUN_SETUP) $(VALGRIND) ./test_cxx_rpc
 
@@ -30,6 +32,8 @@ test_getsockname: $(OUTPRE)test_getsockname.$(OBJEXT)
 
 test_cxx_krb5: $(OUTPRE)test_cxx_krb5.$(OBJEXT) $(KRB5_DEPLIB)
        $(CXX_LINK) $(ALL_CXXFLAGS) -o test_cxx_krb5 $(OUTPRE)test_cxx_krb5.$(OBJEXT) $(KRB5_BASE_LIBS) $(LIBS)
+test_cxx_k5int: $(OUTPRE)test_cxx_k5int.$(OBJEXT) $(KRB5_DEPLIB)
+       $(CXX_LINK) $(ALL_CXXFLAGS) -o test_cxx_k5int $(OUTPRE)test_cxx_k5int.$(OBJEXT) $(KRB5_BASE_LIBS) $(LIBS)
 test_cxx_gss: $(OUTPRE)test_cxx_gss.$(OBJEXT)
        $(CXX_LINK) $(ALL_CXXFLAGS) -o test_cxx_gss $(OUTPRE)test_cxx_gss.$(OBJEXT) $(LIBS)
 test_cxx_rpc: $(OUTPRE)test_cxx_rpc.$(OBJEXT) $(GSSRPC_DEPLIBS)
diff --git a/src/tests/misc/test_cxx_k5int.cpp b/src/tests/misc/test_cxx_k5int.cpp
new file mode 100644 (file)
index 0000000..602fe94
--- /dev/null
@@ -0,0 +1,19 @@
+// Test that the krb5 internal headers are compatible with C++ code.
+// (Some Windows-specific code is in C++ in this source tree.)
+
+#include <stdio.h>
+#include "k5-int.h"
+#include "k5-ipc_stream.h"
+#include "k5-utf8.h"
+
+int main (int argc, char *argv[])
+{
+    krb5_context ctx;
+
+    if (krb5_init_context(&ctx) != 0) {
+       printf("krb5_init_context returned an error\n");
+       return 1;
+    }
+    printf("hello, world\n");
+    return 0;
+}