YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

PI-SDK working with Java? Options · View
garysybex1
#1 Posted : Thursday, June 04, 2009 2:10:39 PM
Rank: Newbie
Groups: Member

Joined: 6/4/2009
Posts: 1
Location: Belfast
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
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.