[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3593
  • Last Modified:

in something not a structure or union

Do we need to set up anything to avoid getting this message?
request for member `GetStringUTFChars' in something not a
structure or union????

D:\HelloWorld\src>gcc -c -o
HelloWorld.o -ID:/jbuilderX/jdk1.4/include -ID:/jbuilderX/jdk1.4/include
/win32 HelloWorldImp.c
HelloWorldImp.c: In function `Java_HelloWorld_checkProcess':
HelloWorldImp.c:49: request for member `GetStringUTFChars' in something not
a structure or union
HelloWorldImp.c:51: request for member `FindClass' in something not a
structure or union
HelloWorldImp.c:54: request for member `ReleaseStringUTFChars' in something
not a structure or union

HelloWorldImp.c:62: request for member `ReleaseStringUTFChars' in something
not a structure or union
0
Joserip
Asked:
Joserip
3 Solutions
 
Sjef BosmanGroupware ConsultantCommented:
Are you compiling Java with C compiler? You use dot-notation, so the C-compiler thinks you refer to structure or union members. I might be completely off, though...
0
 
JoseripAuthor Commented:
when compiling the  c program with dev-cpp this error is generated and trying to kill the
process which is running through c by creating dll  to access in java ..
0
 
Sjef BosmanGroupware ConsultantCommented:
Could you show us some code?
0
 
Jaime OlivaresCommented:
I guess you are trying to accesss java strings, usual way is to use something like this:

c_string = (*javaEnv)->GetStringUTFChars(javaEnv, java_string, 0);

where,
    c_string is char * type
    javaEnv is JNIEnv * type
    java_string is jstring type

So maybe the problem is with 'env' structure

0
 
esorfCommented:
I think you have an extra dereference in there.  You should be able to say

   javaEnv->GetStringUTFChars(javaEnv, java_string, 0);

This is true in C as well as C++ because of some very clever struct design.  Basically, in C the env structure has a method table built into it.  Check out jni.h when you get a chance.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now