Re: [C#] Add code to all non-static methods
William S Fulton <[email protected]> Wed, 27 Oct 2021 19:11:23 +0100
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CANGqftB85ZdPNzxV-2_MT-XU-BUsrnOTT0Q_7jznWASOjA4nHw@mail.gmail.com> |
Are you referring to the 'this' pointer or to parameters in a method? If parameter, that types of parameters? A nullptr is entirely valid of course of pointer types in C++. Maybe you want to modify the default SWIGTYPE *, SWIGTYPE & and SWIGTYPE typemaps. William On Mon, 25 Oct 2021 at 11:08, Alexander Vostres <[email protected]> wrote: > Greetings, > Basically, I'd like to add null check to throw NullReference instead of > getting (non-catchable) AccessViolation from the C++ side. > To do this I need to add something along the lines of "if (ptr == null) > throw;" to all the non-static methods. > So far the closest I've got is modifying csout, however, it applies to all > the methods. > Is there any way to apply a modified csout typemap only to non-static > methods? Or is there any other way to insert couple lines of code into all > the methods? > > Alex > _______________________________________________ > Swig-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/swig-user > _______________________________________________ Swig-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/swig-user