command for compile c to library

My c compiler is : Turbo C 3.0
My OS : Windows XP

I want to link function in C to Java programming by using Java Native Interface (JNI).

But the problem is i couldn't the c file.

here are code :

1. Create a java class file that
. native method declaration
. load library

class NativeHello {
public static void nativeHelloWorld();
static{
System.loadLibrary(“hello1”);
}
}

2. Create a java class file to run the native code

class UseNative {
public static void main(String [] args){
NativeHello nh=new NativeHello();
nh.nativeHelloWorld();
}
}

3. Create jni.h (which is header file provided by Java in order to link between C and Java code.

run command line :
javah –jni NativeHello

4. Create native method in C language

MyNativeHello.c

#include “NativeHello.h"
#include <stdio.h>

void Java_NativeHello_nativeHelloWorld(JNIEnv *env, jobject obj){
printf(“Hello from C”);
}


5. Compiled C code (MyNativeHello.c) into library (hello1.dll) .

tcc –ohello1.dll MyNativeHello.c

at this step , it produces error...

err.. Some details of your error might be useful don't you think?
Topic archived. No new replies allowed.