diff --git a/Doc/Manual/Go.html b/Doc/Manual/Go.html index 03b48d40c..d0d7f4c51 100644 --- a/Doc/Manual/Go.html +++ b/Doc/Manual/Go.html @@ -10,6 +10,7 @@
+Working examples can be found here: +
+ + +@@ -78,7 +90,7 @@ default SWIG will generate code for the gc compilers. To generate code for gccgo, you should also use the -gccgo option.
-@@ -152,7 +164,7 @@ swig -go -help -
When generating Go code, SWIG will generate the following @@ -228,7 +240,7 @@ this: % go tool 6l main.6
@@ -238,7 +250,7 @@ modifications have to occur. This section briefly covers the essential aspects of this wrapping.
-@@ -248,7 +260,7 @@ directive. You may override this by using SWIG's -package command line option.
-@@ -280,7 +292,7 @@ followed by that name, and the destructor will be named Delete followed by that name.
-@@ -288,7 +300,7 @@ C/C++ constants created via #define or the %constant directive become Go constants, declared with a const declaration. -
@@ -298,7 +310,7 @@ usual). The values of the enumeration will become variables in Go; code should avoid modifying those variables.
-@@ -376,21 +388,24 @@ returns a go interface. If the returned pointer can be null, you can check for this by calling the Swigcptr() method.
-Calling NewClassName for some C++ class ClassName will allocate memory using the C++ memory allocator. This memory will -not be automatically freed by Go's garbage collector. When you are -done with the C++ object you must free it using DeleteClassName. +not be automatically freed by Go's garbage collector as the object ownership is +not tracked. When you are done with the C++ object you must free it manually +using DeleteClassName.
A common technique is to store the C++ object into a Go object, and -use the Go function runtime.SetFinalizer to free the C++ -object when the Go object is freed. For example, if the SWIG package -is imported as "wrap": +use the Go function runtime.SetFinalizer to free the C++ object when +the Go object is freed. It is strongly recommended to read the +runtime.SetFinalizer +documentation before using this technique to understand its limitations. +For example, if the SWIG package is imported as "wrap":
@@ -409,7 +424,7 @@ func NewGoClassName() *GoClassName {
@@ -421,7 +436,7 @@ Doing the reverse will require an explicit type assertion, which will be checked dynamically.
-@@ -429,7 +444,7 @@ In order to use C++ templates in Go, you must tell SWIG to create wrappers for a particular template instantation. To do this, use the %template directive. -
@@ -472,7 +487,7 @@ method defined in Go. The Go code may of course call other methods on itself, and those methods may be defined either in Go or in C++.
-@@ -579,7 +594,7 @@ that typemap, or add new values, to control how C/C++ types are mapped into Go types.
-Because of limitations in the way output arguments are processed in swig, @@ -632,7 +647,7 @@ void f(char *output); -
Often the APIs generated by swig are not very natural in go, especially if @@ -727,7 +742,7 @@ func bar() { -