Hi everyone,
I am creating a simple shared library which contains the following files:
mylib.h and mylib.cpp
the code for mylib.pro is:
QT -= gui
TARGET = myLIB
TEMPLATE = lib
SOURCES += mylib.cpp
HEADERS += mylib.h
QT -= gui
TARGET = myLIB
TEMPLATE = lib
SOURCES += mylib.cpp
HEADERS += mylib.h
To copy to clipboard, switch view to plain text mode
#ifndef MYLIB_H
#define MYLIB_H
extern "C"{
__declspec(dllexport) int __stdcall hello();
}
#endif // MYLIB_H
#ifndef MYLIB_H
#define MYLIB_H
extern "C"{
__declspec(dllexport) int __stdcall hello();
}
#endif // MYLIB_H
To copy to clipboard, switch view to plain text mode
the code for mylib.cpp is:
#include "mylib.h"
__declspec(dllexport) int __stdcall hello()
{
return 56; [QUOTE]hello() is a simple function which returns 56[/QUOTE]
}
#include "mylib.h"
__declspec(dllexport) int __stdcall hello()
{
return 56; [QUOTE]hello() is a simple function which returns 56[/QUOTE]
}
To copy to clipboard, switch view to plain text mode
After building the project, i am getting a myLIB.dll file in debug directory. I am able to use this DLL in a visual C# project by referencing to the DLL in C# code.
But i am not able to use the hello() function of the DLL in java.
So, can anyone please tell me the correct way of creating a DLL in Qt, which i can further use in Java? 
Thanks in advance,
With regards,
Satya Prakash.
Bookmarks