Defining the aliases by default results in conflicts when including headers from multiple modules as e.g. SWIG_PendingException_get() is defined in all of them, and could also easily result in other unwanted clashes, so make this opt-in and update the examples and tests relying on using the wrappers without the module prefix to define SWIG_DEFINE_WRAPPER_ALIASES explicitly.
47 lines
973 B
C
47 lines
973 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#define SWIG_DEFINE_WRAPPER_ALIASES
|
|
#include "exception_order/exception_order_wrap.h"
|
|
|
|
int main() {
|
|
A* a = A_new();
|
|
|
|
A_foo(a);
|
|
if (!SWIG_PendingException_get()) {
|
|
fprintf(stderr, "foo: bad exception order\n");
|
|
} else {
|
|
SWIG_PendingException_reset();
|
|
}
|
|
|
|
A_bar(a);
|
|
if (!SWIG_PendingException_get()) {
|
|
fprintf(stderr, "bar: bad exception order\n");
|
|
} else {
|
|
SWIG_PendingException_reset();
|
|
}
|
|
|
|
A_foobar(a);
|
|
if (!SWIG_PendingException_get()) {
|
|
fprintf(stderr, "foobar: bad exception order\n");
|
|
} else {
|
|
SWIG_PendingException_reset();
|
|
}
|
|
|
|
A_barfoo(a, 1);
|
|
if (!SWIG_PendingException_get()) {
|
|
fprintf(stderr, "barfoo(1): bad exception order\n");
|
|
} else {
|
|
SWIG_PendingException_reset();
|
|
}
|
|
|
|
A_barfoo(a, 2);
|
|
if (!SWIG_PendingException_get()) {
|
|
fprintf(stderr, "barfoo(2): bad exception order\n");
|
|
} else {
|
|
SWIG_PendingException_reset();
|
|
}
|
|
|
|
exit(0);
|
|
}
|
|
|