From a4432a68da2d85323f65f8205f18451c0979395e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Jul 2019 21:12:04 +0200 Subject: Correct %init documentation for C#/Java For these languages, %init doesn't inject the code into the initialization function (because there is none), but just puts it into the global scope instead. [skip ci] --- Doc/Manual/SWIG.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Doc/Manual/SWIG.html b/Doc/Manual/SWIG.html index d1492d30a..aec48ef03 100644 --- a/Doc/Manual/SWIG.html +++ b/Doc/Manual/SWIG.html @@ -3438,6 +3438,18 @@ initialization on module loading, you could write this: %} +

+Please note that some language backends (e.g. C# or Java) don't have any +initialization function, hence you should define a global object performing +the necessary initialization for them instead: +

+ +
+%init %{
+  static struct MyInit { MyInit() { init_variables(); } } myInit;
+%}
+
+

5.7 An Interface Building Strategy

-- cgit v1.2.3