0

I know it's a very common scenario. I need to call two methods from my java code written in following cpp files:

//test.cpp
#include <somelib.h>
#include <test.h>
method1 ("hello" , "test", "result1");
method2 ("result1", "test_Case", "result2");

And the definitions of above methods are written in somelib.lib lib file. Here i am pasting the content of header file related to somelib.lib.

//somelib.h
#define _SOME_LIB_H

void method1 (string a, string b, string c);
void method2 (string c, string e, string h);

I can't paste the content of .lib file because i didn't found any .exe to read it.

How should i create the dll so that i can access the above methods by calling it.

Amit Pal
  • 10,604
  • 26
  • 80
  • 160
  • 2
    That depends on the compiler; you're also limiting yourself to the Win platform with DLL. Do you specifically want a DLL or just the ability to call this code from Java? – RonaldBarzell Dec 17 '12 at 16:31
  • No, I just want to call this code from java. I wrote about dll because i read it somewhere that we can call dll file from JNI. Can we call the java code without using JNI? – Amit Pal Dec 17 '12 at 16:32
  • Have you tried http://www.javaworld.com/javatips/jw-javatip17.html – RonaldBarzell Dec 17 '12 at 16:37
  • Not yet, but looking into it. Actually i have never worked on this kind of issue. Would you please tell me whether can i call the lib content from javatip or not? – Amit Pal Dec 17 '12 at 16:39
  • You can, it's just a matter of going through the process. Most languages have some level of inter-operability, especially with C/C++ code. – RonaldBarzell Dec 17 '12 at 16:42

0 Answers0