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