(Please don't spam all the lists; if it's a usage oriented question,
use the users list, if it has to do with the library internals, use
the dev list)
On Jun 10, 2007, at 10:40 PM, 张久安 wrote:
Hello,
I am very glad to say it work properly, and i had a try. But if i
change the above program to:
(hello.dll)
struct student{
int age;
char * name;
void show();
};
void student::showInfo() {
printf("name is: %s, age is%d\n", name, age);
}
void print(struct student stu) {
stu.show();
}
then, i can't make it work properly with jna. I wonder is there
some idea for me to change the class Structure to support the
native struct with function.
There is no explicit C++ support in JNA; you should look at your
compiler documentation to determine exactly what the difference is in
memory layout between the two versions. It's entirely possible that
the C++ object is laid out differently in memory than the C struct.
As for usage, (struct student stu) is not guaranteed to work, you
should use (struct student* stu) instead, since structures as
argument are not handled consistently across compilers and platforms.