Interfacing Parallel Port/ Erstellen einer dll
-
Hallo,
Über ein C-Programm greife ich lesend und schreibend auf den Parallel Port zu,
dafür verwende ich Funktionen der Inpout32.dll, was auch funktioniert.Jetzt bin ich gerade dabei, über JNI ein Interface zu Java herzustellen, dazu
muss ich aus meinem C-Programm eine dll erstellen. Bei der dll Erstellung tritt
ein Problem auf:-
Ich arbeite mit Microsoft Visual C++ und erstellte ein
Win32 Dynamic-Link Library Projekt, habe meinen Code integriert und die
JNI spezifischen Namenskonventionen eingearbeitet -
Beim Kompilieren/ Linken bekomme ich folgende Fehlermeldung:
InpoutTest.obj: error LNK2001: Nichtaufgeloestes externes Symbol _Inp32@4
InpoutTest.obj: error LNK2001: Nichtaufgeloestes externes Symbol _Out32@8
Debug/test.dll: fatal error LNK1120: 2 unaufgeloeste externe Verweise
Fehler beim Ausführen von link.exe
test.dll - 3 Fehler, 3 Warnungen
Hier komme ich nicht weiter, die Inpout32.dll liegt definitiv im Systemordner
und ich kann die Fehler nicht auflösen. Weiss jemand, wie ich die Fehler
beheben könnte?Code von Test.c
// ---------------------------------------------------------------------------
// InpoutTest.cpp : Defines the entry point for the console application.#include "stdafx.h"
#include "stdio.h"
#include "string.h"
#include "stdlib.h"#include "jni.h"
#include "test.h"/* ----Prototypes of Inp and Outp--- /
short _stdcall Inp32(short PortAddress);
void _stdcall Out32(short PortAddress, short data);
/--------------------------------*/JNIEXPORT jint JNICALL readPort(JNIEnv *env, jobject obj)
{
jint data = 0;
data = Inp32(atoi("888"));
return data;
}JNIEXPORT void writePort(JNIEnv *env, jobject obj)
{
Out32(atoi("890"),atoi("32"));
return;
}
// ---------------------------------------------------------------------------Code von Test.h
// ---------------------------------------------------------------------------
#include "jni.h"#ifndef _Included_Test
#define _Included_Test
#ifdef __cplusplus
extern "C" {
#endifJNIEXPORT jint JNICALL readPort(JNIEnv *env, jobject obj);
JNIEXPORT void writePort(JNIEnv *env, jobject obj);#ifdef __cplusplus
}
#endif
#endif
-