J
Joakim Hove
Hello,
I have a quite large library of datastructures implemented in C. All
the datastructures are implemented like this:
/***************************************/
//header file:
typedef struct my_struct my_type;
//implementation
struct my_struct {
// fields in the struct
}
my_type * my_alloc( /* input_args */ ) {
// Create and initialize a my_struct instance.
}
void my_free( my_type * instance ) {
// Free the instance along with all it's fields.
}
// And then various set/get/do_whatever functions
/**************************/
I.e. everything is implemented through opaque pointers, and all
manipulations are based on designated functions which take a pointer
instance as the first argument.
Now - I would like to access this functionality from a C++ program as
well, i.e. I would like to create C++ classes which encapsulate the C
functionality. I have done this manually for some "classes" and that
works OK, but I would strongly like to automate the process. I have
considered writing some Python code to do it, but maybe there is a
better way?
Any tips on how to do this?
Joakim
I have a quite large library of datastructures implemented in C. All
the datastructures are implemented like this:
/***************************************/
//header file:
typedef struct my_struct my_type;
//implementation
struct my_struct {
// fields in the struct
}
my_type * my_alloc( /* input_args */ ) {
// Create and initialize a my_struct instance.
}
void my_free( my_type * instance ) {
// Free the instance along with all it's fields.
}
// And then various set/get/do_whatever functions
/**************************/
I.e. everything is implemented through opaque pointers, and all
manipulations are based on designated functions which take a pointer
instance as the first argument.
Now - I would like to access this functionality from a C++ program as
well, i.e. I would like to create C++ classes which encapsulate the C
functionality. I have done this manually for some "classes" and that
works OK, but I would strongly like to automate the process. I have
considered writing some Python code to do it, but maybe there is a
better way?
Any tips on how to do this?
Joakim