swig/Examples/test-suite/c/cpp11_shared_ptr_const_runme.c
Vadim Zeitlin e8f9bdba80 Remove wrapper aliases generation and use -namespace in the tests
The -namespace option provides a better way of using the wrapped API, so
drop the optional wrapper generation, which is useless when this option
is used and just generates many lines of unwanted junk in the header.

Update the test suite and the examples to compensate to not rely on
being able to define SWIG_DEFINE_WRAPPER_ALIASES and add -namespace
option to all C++ tests, as it's done for C# test suite, and update them
to use the correct prefix and also use the accessors for the global
variables rather than using them directly, as this is impossible when
namespace prefix is used (it would have been possible to define a
preprocessor symbol corresponding to the real variable name, but it's
arguably not worth it).

fixup! Remove wrapper aliases generation and use -namespace in the tests
2021-11-10 02:11:59 +01:00

16 lines
472 B
C

#include "cpp11_shared_ptr_const_wrap.h"
#include <assert.h>
int main(int argc, const char *argv[]) {
cpp11_shared_ptr_const_Foo* f;
cpp11_shared_ptr_const_Foo* f2;
f = cpp11_shared_ptr_const_Foo_new(17);
assert(cpp11_shared_ptr_const_Foo_get_m(f) == 17);
f2 = cpp11_shared_ptr_const_foo(f);
assert(cpp11_shared_ptr_const_Foo_get_m(f2) == 17);
cpp11_shared_ptr_const_Foo_delete(f2);
cpp11_shared_ptr_const_Foo_delete(f);
return 0;
}