1 // Tests SWIG's handling of pass-by-value for complex datatypes
8 /* Some functions that manipulate Vectors by value */
10 extern double dot_product(Vector a, Vector b);
11 extern Vector vector_add(Vector a, Vector b);
14 /* Include this because the vector_add() function will leak memory */
17 /* Some helper functions for our interface */
20 Vector *new_Vector(double x, double y, double z) {
21 Vector *v = (Vector *) malloc(sizeof(Vector));
28 void vector_print(Vector *v) {
29 printf("Vector %p = (%g, %g, %g)\n", v, v->x, v->y, v->z);