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
55 lines
899 B
OpenEdge ABL
55 lines
899 B
OpenEdge ABL
%module namespace_extend
|
|
|
|
%warnfilter(SWIGWARN_RUBY_WRONG_NAME) bar; /* Ruby, wrong class name */
|
|
|
|
%{
|
|
namespace foo {
|
|
class bar {
|
|
public:
|
|
};
|
|
}
|
|
%}
|
|
|
|
// C uses different naming convention, with all functions starting with the class prefix
|
|
// and using the global namespace prefix too, if specified (which is the case for the tests).
|
|
#ifdef SWIGC
|
|
%{
|
|
foo::bar *namespace_extend_foo_bar_new() {
|
|
return new foo::bar;
|
|
}
|
|
void namespace_extend_foo_bar_delete(foo::bar *self) {
|
|
delete self;
|
|
}
|
|
|
|
int namespace_extend_foo_bar_blah(foo::bar *self, int x) {
|
|
return x;
|
|
}
|
|
%}
|
|
#else
|
|
%{
|
|
foo::bar *new_foo_bar() {
|
|
return new foo::bar;
|
|
}
|
|
void delete_foo_bar(foo::bar *self) {
|
|
delete self;
|
|
}
|
|
|
|
int foo_bar_blah(foo::bar *self, int x) {
|
|
return x;
|
|
}
|
|
%}
|
|
#endif
|
|
|
|
namespace foo {
|
|
class bar {
|
|
public:
|
|
%extend {
|
|
bar();
|
|
~bar();
|
|
int blah(int x);
|
|
};
|
|
};
|
|
}
|
|
|
|
|
|
|