Has anyone got any experience getting the PI-SDK working with Java?
I have limited experience with PI-SDK but was trying to call a function in a C++ dll using a JNI wrapper. I am having problem getting my C++ dll compiled with the PISDK.dll
Here is my java code that calls the C++ dll.
class Test1
{
static
{
System.loadLibrary("TestDll");
}
public static void main(String ar[])
{
System.out.println("Inside Java");
Test1 t=new Test1();
t.inDll();
}
public native void inDll();
}
I have created a C++ MFC dll project in VS2005 and I have included my Test1.h file in my C++ project (this has been automatically generated by javah -jni Test1). This included
JNIEXPORT void JNICALL Java_Test1_inDll (JNIEnv *, jobject);
Here is my TestDll.cpp file (I have excluded the PI SDK C++ code!)
#include "stdafx.h"
#include "TestDll.h"
#include "Test1.h"
#include <windows.h>
#include <atlbase.h>
#include <iostream>
#import "pisdkcommon.dll" no_namespace
#import "piTimeServer.dll" no_namespace
#import "pisdk.dll" no_namespace
JNIEXPORT void JNICALL Java_Test1_inDll(JNIEnv *env, jobject obj)
{
AfxMessageBox(_T("In C++ dll!"));
}
However, during compilation I get the following errors because the pisdk.dll has been included.
error C2787: '_DAOSuppHelp' : no GUID has been associated with this object c:\documents and settings\connollyg\my documents\visual studio 2005\projects\testdll\testdll\debug\pisdk.tlh 594
error C3203: '_com_IIID' : unspecialized class template can't be used as a template argument for template parameter '_IIID', expected a real type c:\documents and settings\connollyg\my documents\visual studio 2005\projects\testdll\testdll\debug\pisdk.tlh 594
Can any shed any light on this?
Cheers