B
Bharath Raghunathan
Hello,
I have a library with the following structure:
typedef struct val_variable_string {
int offset;
int size;
char first_byte;
} val_t;
There is a function that operates on the above structure as shown below
int fun1(val_t *v)
{
int i;
char *ptr= &v->first_byte;
for (i=0; i< v->size; i++)
printf ("%c", ptr);
printf ("\n");
}
Since this is a c variable structure it is allocated in the following
way and passed onto the above function as below:
mv1 = (struct val_variable_string *) malloc(sizeof(struct
val_variable_string) + 20 );
mv1->offset = 0 ;
mv1->size = strlen(TEST_STRING);
strncpy ( &mv1->first_byte, TEST_STRING, mv1->size);
fun1(mv1);
Now Can the JNI code be generated to achieve a similar functionality
using SWIG? Is there any alternate way to achieve the above
functionality from JAVA layer.
Any help is appreciated.
Thanks in Advance
--Bharath
I have a library with the following structure:
typedef struct val_variable_string {
int offset;
int size;
char first_byte;
} val_t;
There is a function that operates on the above structure as shown below
int fun1(val_t *v)
{
int i;
char *ptr= &v->first_byte;
for (i=0; i< v->size; i++)
printf ("%c", ptr);
printf ("\n");
}
Since this is a c variable structure it is allocated in the following
way and passed onto the above function as below:
mv1 = (struct val_variable_string *) malloc(sizeof(struct
val_variable_string) + 20 );
mv1->offset = 0 ;
mv1->size = strlen(TEST_STRING);
strncpy ( &mv1->first_byte, TEST_STRING, mv1->size);
fun1(mv1);
Now Can the JNI code be generated to achieve a similar functionality
using SWIG? Is there any alternate way to achieve the above
functionality from JAVA layer.
Any help is appreciated.
Thanks in Advance
--Bharath