Add in defines to optionally remove the C# exception and string helper support code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9065 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
6c2831ffe7
commit
069ec58ea5
1 changed files with 8 additions and 1 deletions
|
|
@ -4,7 +4,8 @@
|
||||||
*
|
*
|
||||||
* csharphead.swg
|
* csharphead.swg
|
||||||
*
|
*
|
||||||
* C# support code
|
* Support code for exceptions if the SWIG_CSHARP_NO_EXCEPTION_HELPER is not defined
|
||||||
|
* Support code for strings if the SWIG_CSHARP_NO_STRING_HELPER is not defined
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
%insert(runtime) %{
|
%insert(runtime) %{
|
||||||
|
|
@ -13,6 +14,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
#if !defined(SWIG_CSHARP_NO_EXCEPTION_HELPER)
|
||||||
%insert(runtime) %{
|
%insert(runtime) %{
|
||||||
/* Support for throwing C# exceptions from C/C++. There are two types:
|
/* Support for throwing C# exceptions from C/C++. There are two types:
|
||||||
* Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */
|
* Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */
|
||||||
|
|
@ -270,7 +272,9 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
#endif // SWIG_CSHARP_NO_EXCEPTION_HELPER
|
||||||
|
|
||||||
|
#if !defined(SWIG_CSHARP_NO_STRING_HELPER)
|
||||||
%insert(runtime) %{
|
%insert(runtime) %{
|
||||||
/* Callback for returning strings to C# without leaking memory */
|
/* Callback for returning strings to C# without leaking memory */
|
||||||
typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
|
typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
|
||||||
|
|
@ -305,7 +309,10 @@ extern "C"
|
||||||
SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_$module(SWIG_CSharpStringHelperCallback callback) {
|
SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_$module(SWIG_CSharpStringHelperCallback callback) {
|
||||||
SWIG_csharp_string_callback = callback;
|
SWIG_csharp_string_callback = callback;
|
||||||
}
|
}
|
||||||
|
%}
|
||||||
|
#endif // SWIG_CSHARP_NO_STRING_HELPER
|
||||||
|
|
||||||
|
%insert(runtime) %{
|
||||||
/* Contract support */
|
/* Contract support */
|
||||||
|
|
||||||
#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
|
#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue