S
skoopy
Gast
Hallo Zusammen
und zwar habe ich da in Problem beim Einbindn der MemBrainDLL.dll. Die MemBrainDLL.dll beinhaltet funktionen, die ich alle für mein Java-Programm zur Verfuegung stellen möchte. Da ich zum ersten mal eine DLL in java einbinde, hab ich zunächst einmal das Typische "HelloWorld" Beispiel durchgespielt, was auch erfolgreich war. Nur war es da so, dass man sich die DLL selber generiert hat und später wieder aufgerufen hat.
Aber bei MemBrain, liegen mir nur die DLL, die Lib und die Header Datei. Bevor ich alle Methoden integriere, habe ich erst eine Klase geschrieben, die mir die Funktion MB_GetVersionInfo aus gibt. doch das hat nicht geklappt und jetzt wollte ich euch fragen, ob irgennt jemand hier den Fehler aufspührt. Was übersehe ich hier???
Hier die Codes:
MamBrain_inc.java:
MemBrain_inc.h
ob ich die Lib jetzt brauch oder nicht, ist mir auch unklar, aber laut den Beispielen nicht wirklich, oder? Die Dll heist MemBrainDll.dll
Ich hoffe, das mir hier jemand weiterhelfen kann und die Infos auch ausrecihend sind. Fuers erste wollte ichmir nur die Version der DLL ausgeben lassen.
danke und Gruss
skoopy
und zwar habe ich da in Problem beim Einbindn der MemBrainDLL.dll. Die MemBrainDLL.dll beinhaltet funktionen, die ich alle für mein Java-Programm zur Verfuegung stellen möchte. Da ich zum ersten mal eine DLL in java einbinde, hab ich zunächst einmal das Typische "HelloWorld" Beispiel durchgespielt, was auch erfolgreich war. Nur war es da so, dass man sich die DLL selber generiert hat und später wieder aufgerufen hat.
Aber bei MemBrain, liegen mir nur die DLL, die Lib und die Header Datei. Bevor ich alle Methoden integriere, habe ich erst eine Klase geschrieben, die mir die Funktion MB_GetVersionInfo aus gibt. doch das hat nicht geklappt und jetzt wollte ich euch fragen, ob irgennt jemand hier den Fehler aufspührt. Was übersehe ich hier???
Hier die Codes:
MamBrain_inc.java:
Code:
public class MemBrain_inc{
static{
System.loadLibrary("MemBrainDll");
}
public native void MB_GetVersionInfo();
public static void main(String args[]) {
MemBrain_inc caller= new MemBrain_inc();
caller.MB_GetVersionInfo();
}
}
MemBrain_inc.h
Code:
#include <jni.h>
#ifndef _Included_MemBrain_inc
#define _Included_MemBrain_inc
/// Allows use of plain C-Compilers, too
#ifdef __cplusplus
extern "C" {
#endif
/// Definition of the membrain integer as 32 bit integer
typedef long int _MB_INT;
/// Possible return values of most MemBrain DLL interfaces
typedef enum
{
MEMBRAIN_ERR = -1, ///< An error occured
MEMBRAIN_OK = 0, ///< Call successful
} EMBRetVal;
/// Set by
#ifndef _USRDLL
#define _USRDLL 0
#endif
#if _USRDLL == 0
/// Get the version information string of the DLL.
/// Specify maximum length of string to be copied (excluding the terminating '\0'.
/// A terminating '\0' will be attached in every case.
EMBRetVal __declspec(dllimport) __stdcall _MB_GetVersionInfo(char* pInfo, _MB_INT maxLen);
/// Add a new neural net to the DLL's internal array of neural nets.
void __declspec(dllimport) __stdcall _MB_AddNet(void);
/// Get number of currently available neural nets in the DLL's array
_MB_INT __declspec(dllimport) __stdcall _MB_GetNetCount(void);
/// Get index of the currently selected net
_MB_INT __declspec(dllimport) __stdcall _MB_GetSelectedNet(void);
/// Delete the neural net at index <idx>.
EMBRetVal __declspec(dllimport) __stdcall _MB_DeleteNet(_MB_INT idx);
/// Select one of the available nets as the currently active one.
EMBRetVal __declspec(dllimport) __stdcall _MB_SelectNet(_MB_INT idx);
/// Load the currently active neural net from the given *.mbn file (including path)
EMBRetVal __declspec(dllimport) __stdcall _MB_LoadNet(const char* pFileName);
/// Save a MemBrain neural net to the given *.mbn file (including path)
EMBRetVal __declspec(dllimport) __stdcall _MB_SaveNetAs(const char* pFileName);
/// Save an already loaded MemBrain neural net (overwrite original file)
EMBRetVal __declspec(dllimport) __stdcall _MB_SaveNet();
/// Reset the net. All activations and link spikes are set to 0.
void __declspec(dllimport) __stdcall _MB_ResetNet();
/// Get number of input neurons in the net
_MB_INT __declspec(dllimport) __stdcall _MB_GetInputCount();
/// Get number of output neurons in the net
_MB_INT __declspec(dllimport) __stdcall _MB_GetOutputCount();
/// Get name of input neuron at index <idx>. Specify maximum length
/// of string to be copied (excluding the terminating '\0'.
/// A terminating '\0' will be attached in every case.
EMBRetVal __declspec(dllimport) __stdcall _MB_GetInputName(_MB_INT idx, char* pName, _MB_INT maxLen);
/// Get name of output neuron at index <idx>. Specify maximum length
/// of string to be copied (excluding the terminating '\0'.
/// A terminating '\0' will be attached in every case.
EMBRetVal __declspec(dllimport) __stdcall _MB_GetOutputName(_MB_INT idx, char* pName, _MB_INT maxLen);
/// Apply an activation value to the input neuron at index <idx>.
EMBRetVal __declspec(dllimport) __stdcall _MB_ApplyInputAct(_MB_INT idx, double act);
/// Get the activation value of the input neuron at index <idx>.
EMBRetVal __declspec(dllimport) __stdcall _MB_GetInputAct(_MB_INT idx, double* pAct);
/// Perform one think step of the net
void __declspec(dllimport) __stdcall _MB_ThinkStep();
/// Get the activation value of the output neuron at index <idx>.
EMBRetVal __declspec(dllimport) __stdcall _MB_GetOutputAct(_MB_INT idx, double* pAct);
/// Get the output value of the output neuron at index <idx>.
EMBRetVal __declspec(dllimport) __stdcall _MB_GetOutputOut(_MB_INT idx, double* pOutVal);
/// Get index of the last output winner neuron of the net. Return -1 if unknown. Else
/// return the output neuron index of the winner neuron.
_MB_INT __declspec(dllimport) __stdcall _MB_GetOutputWinnerNeuron();
/// Get the activation range of the input neuron at index <idx>.
EMBRetVal __declspec(dllimport) __stdcall _MB_GetInputActRange(_MB_INT idx, double* pActMin,
double* pActMax);
/// Get the activation range of the output neuron at index <idx>.
EMBRetVal __declspec(dllimport) __stdcall _MB_GetOutputActRange(_MB_INT idx, double* pActMin,
double* pActMax);
#endif
JNIEXPORT void JNICALL Java_MemBrain_inc_MB_GetVersionInfo()
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
ob ich die Lib jetzt brauch oder nicht, ist mir auch unklar, aber laut den Beispielen nicht wirklich, oder? Die Dll heist MemBrainDll.dll
Ich hoffe, das mir hier jemand weiterhelfen kann und die Infos auch ausrecihend sind. Fuers erste wollte ichmir nur die Version der DLL ausgeben lassen.
danke und Gruss
skoopy