I want to call a 'C'api called BUICInit() in vendors dll from java using JNI.but the generated function name using
javah is java_classname_API().so I kept my own dll and from my dll i called vendors dll..

I used loadlibrary()/getprocaddress()..it is working but is there any possiblities with out using getprocaddress

this is my sample program which i used to call vendor dll from my dll..

#include <jni.h>
#include <stdio.h>
#include "HelloWorld.h"
#include<windows.h>

typedef int (*MYPROC)();
 JNIEXPORT void JNICALL
 Java_HelloWorld_print(JNIEnv *env, jobject obj)
 {
      HINSTANCE hinstLib; 
    MYPROC ProcAdd; 
printf("in the function");
 hinstLib = LoadLibrary(TEXT("buicap32.dll")); 
printf("in the function");
  if (hinstLib != NULL) 
    { 
        printf("sucess");
        ProcAdd = (MYPROC) GetProcAddress(hinstLib, "BUICInit"); 

        printf("add2(3): %d",ProcAdd());

    if (NULL != ProcAdd) 
    {
     printf("fail");

        }
        // Free the DLL module.


    }  
 }

thanks

you should go through guidance given by vendor for the dll api...

if you have any error or exception while calling method from dll using jni then you should
post your bugs in the vendor's forum..

They gave only the library dll files.. They dont have code samples for java interface..
is there any possibility to call the exact apiname()(eg:BUICInit() in vendors dll) without using GetProcAddress/LoadLibrary() in JNI calling method.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.