swig/Examples/c/exception/runme.c
Maciej Drwal 54860c9595 1. Fixed the bug in enums. Now 'enums' test is compiling OK.
2. -noexcept flag disables generating exception-related code (like array of type names in SwigObj, object registry, etc.). This can be used when we are sure we won't handle exceptions on the C side, and this will generate much less code. 
3. Modified typemaps for object arrays. Multidimensional ones still needs some fixing.
4. Added 'enums' and 'cast_operator' runtime tests.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@10771 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-08-17 13:42:19 +00:00

61 lines
1,008 B
C

/*
* NOTE: this won't run with -noexcept flag
*/
#include <stdio.h>
#include "example_proxy.h"
int main() {
Test *t = new_Test();
SWIG_try {
Test_unknown(t);
}
SWIG_catch(SWIG_AnyException) {
printf("incomplete type: %s\n", SWIG_exc.msg);
}
SWIG_endtry;
SWIG_try {
Test_simple(t);
}
SWIG_catch(SWIG_AnyException) {
printf("%s\n", SWIG_exc.msg);
}
SWIG_endtry;
SWIG_try {
Test_message(t);
}
SWIG_catch(SWIG_AnyException) {
printf("%s\n", SWIG_exc.msg);
}
SWIG_endtry;
SWIG_try {
Test_hosed(t);
}
SWIG_catch(Exc) {
printf("%d %s\n", Exc_code_get(SWIG_exc.klass),
Exc_msg_get(SWIG_exc.klass));
}
int i;
for (i = 0; i < 4; ++i) {
SWIG_try {
Test_multi(t, i);
}
SWIG_catch(Exc) {
printf("%d %s\n", Exc_code_get(SWIG_exc.klass),
Exc_msg_get(SWIG_exc.klass));
}
SWIG_catch(SWIG_AnyException) {
printf("%s\n", SWIG_exc.msg);
}
SWIG_endtry;
}
SWIG_exit(0);
}