4 #if !defined(SWIGJAVA) && !defined(SWIGCSHARP)
5 %apply SWIGTYPE *DYNAMIC { Foo * };
20 #if defined(SWIGJAVA) || defined(SWIGCSHARP)
21 %typemap(out) Foo *blah {
22 Bar *downcast = dynamic_cast<Bar *>($1);
23 *(Bar **)&$result = downcast;
28 %typemap(javaout) Foo * {
29 return new Bar($jnicall, $owner);
33 #if defined(SWIGCSHARP)
34 %typemap(csout, excode=SWIGEXCODE) Foo * {
35 Bar ret = new Bar($imcall, $owner);$excode
42 class Bar : public Foo {
47 virtual char * test() {
48 return (char *) "Bar::test";
52 char *do_test(Bar *b) {
57 #if !defined(SWIGJAVA) && !defined(SWIGCSHARP)
58 // A general purpose function for dynamic casting of a Foo *
60 static swig_type_info *
61 Foo_dynamic(void **ptr) {
63 b = dynamic_cast<Bar *>((Foo *) *ptr);
66 return SWIGTYPE_p_Bar;
72 // Register the above casting function
73 DYNAMIC_CAST(SWIGTYPE_p_Foo, Foo_dynamic);