I
It's me
I am playing around with SWING building a Python module using the no brainer
example in http://www.swig.org/tutorial.html. With that first example,
/* File : example.c */
#include <time.h>
double My_variable = 3.0;
int fact(int n) {
if (n <= 1) return 1;
else return n*fact(n-1);
}
int my_mod(int x, int y) {
return (x%y);
}
char *get_time()
{
time_t ltime;
time(<ime);
return ctime(<ime);
}
and using the swig file of:
/* example.i */
%module example
%{
/* Put header files here (optional) */
%}
extern double My_variable;
extern int fact(int n);
extern int my_mod(int x, int y);
extern char *get_time();
I was able to execute this Python script:
However, when I try to access the gloabl variable My_variable by doing:
print example.cvar
I get a blank (rather then a value of 3.0).
Why?
example in http://www.swig.org/tutorial.html. With that first example,
/* File : example.c */
#include <time.h>
double My_variable = 3.0;
int fact(int n) {
if (n <= 1) return 1;
else return n*fact(n-1);
}
int my_mod(int x, int y) {
return (x%y);
}
char *get_time()
{
time_t ltime;
time(<ime);
return ctime(<ime);
}
and using the swig file of:
/* example.i */
%module example
%{
/* Put header files here (optional) */
%}
extern double My_variable;
extern int fact(int n);
extern int my_mod(int x, int y);
extern char *get_time();
I was able to execute this Python script:
However, when I try to access the gloabl variable My_variable by doing:
print example.cvar
I get a blank (rather then a value of 3.0).
Why?