Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
January 15, 2007 Problem with header-file | ||||
---|---|---|---|---|
| ||||
Hi! Im a newbie to C++ and have a problem compiling with the DMC. I included a header-file (.h) into an very simple cpp-programm. In this file is e.g. a line like this: int WINAPI CasioIO_RespondToReceive(HCASIOIO handle, BYTE rows, BYTE columns, double * values); DMC reports errors cause of an missing "," and errors cause the "*", but the code should be correct. Have i to change the lines for DMC? Or is this header-file-line wrong? greetings davidek |
January 15, 2007 Re: Problem with header-file | ||||
---|---|---|---|---|
| ||||
Posted in reply to davidek | davidek skrev: > Hi! > > Im a newbie to C++ and have a problem compiling with the DMC. > I included a header-file (.h) into an very simple cpp-programm. > > In this file is e.g. a line like this: > > int WINAPI CasioIO_RespondToReceive(HCASIOIO handle, BYTE rows, BYTE columns, > double * values); > > DMC reports errors cause of an missing "," and errors cause the "*", but the > code should be correct. > Have i to change the lines for DMC? Or is this header-file-line wrong? Do you have a decleration of HCASIOIO? I don't think it is a standard one. -- Just another homepage: http://damb.dk But it's mine - Bertel |
January 16, 2007 Re: Problem with header-file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bertel Brander | The complete Header-File, which was delivered with an CasioIO.dll, is the following: (casioio.h) #define HCASIOIO int #define IOTYPE_CFX 1 #define ERR_NOTSUPPORTED 2 #define ERR_COMMPORT 4 #define TYPE_VALUE 1 #define TYPE_MATRIX 2 #define TYPE_LIST 3 typedef void (*CASIOIO_EVENT)(); int WINAPI CasioIO_Uninit(); int WINAPI CasioIO_RespondToReceive(HCASIOIO handle, BYTE rows, BYTE columns, double * values); int WINAPI CasioIO_AfterReceive(HCASIOIO handle, BYTE * type, BYTE * name); int WINAPI CasioIO_AfterSend(HCASIOIO handle, BYTE * type, BYTE * name, BYTE * rows, BYTE * columns, double * values); int WINAPI CasioIO_Init(BYTE comport, int iotype); HCASIOIO WINAPI CasioIO_Open(int authorID, int productID, CASIOIO_EVENT sendproc, CASIOIO_EVENT receiveproc); int WINAPI CasioIO_Close(HCASIOIO handle); |
January 16, 2007 Re: Problem with header-file | ||||
---|---|---|---|---|
| ||||
Posted in reply to davidek | davidek skrev: > The complete Header-File, which was delivered with an CasioIO.dll, is the > following: (casioio.h) > [snip code] Do you include windows.h before casioio.h ? If not, try it. Do you have a .lib file for the dll? -- Just another homepage: http://damb.dk But it's mine - Bertel |
January 17, 2007 Re: Problem with header-file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bertel Brander | Yes, i included windows.h before casioio.h. Yes, i have a .lib file too. (It was delivered with the .dll too.) davidek |
January 17, 2007 Re: Problem with header-file | ||||
---|---|---|---|---|
| ||||
Posted in reply to davidek | davidek skrev: > Yes, i included windows.h before casioio.h. > > Yes, i have a .lib file too. (It was delivered with the .dll too.) Strange. I wrote this: #include <windows.h> #include "casioio.h" HCASIOIO Handle; void SendFunc() { } void RecvFunc() { double X[] = {1, 2}; CasioIO_RespondToReceive(Handle, 2, 3, X); } int main() { CasioIO_Init(1, 0); Handle = CasioIO_Open(123, 321, SendFunc, RecvFunc); } It compiles without problems. casioio.h is a file with the content you posted. Can you post a complete example that show the problem? Can I download casioio.h/.dll/.lib ? -- Just another homepage: http://damb.dk But it's mine - Bertel |
January 18, 2007 Re: Problem with header-file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bertel Brander Attachments: | Hi! The background to my problem: I started to learn java-programming. Now i want to call functions of this dll out of java. For that i use the JNI (Java Native Interface), which allows to use DLLs in java. I have to call the CasioIO.dll out of an new DLL, that i try to create (Wrapper). But i simply dont get the DLLs functions in the cpp-programm. At he current state the Optlink reports "Error 42: Symbol Undefined" about the CasioIO-methods. Here is a link to the CasioIO-download: http://users.pandora.be/gp/casio/casioio/casioio_sdk.zip My files are in the attachment. Greetings davidek |
January 18, 2007 Re: Problem with header-file | ||||
---|---|---|---|---|
| ||||
Posted in reply to davidek | davidek skrev: > Hi! > > The background to my problem: I started to learn java-programming. Now i want to > call functions of this dll out of java. For that i use the JNI (Java Native > Interface), which allows to use DLLs in java. > > I have to call the CasioIO.dll out of an new DLL, that i try to create (Wrapper). > But i simply dont get the DLLs functions in the cpp-programm. > > At he current state the Optlink reports "Error 42: Symbol Undefined" about the > CasioIO-methods. You could do: #include <windows.h> #include <iostream> #include "../SDK/vc/casioio.h" #include "jni_test.h" //This includes the JNI. It is an header file created by a java-sdk-tool. typedef int WINAPI (*CasioIO_UninitPtrT)(); CasioIO_UninitPtrT CasioIO_UninitPtr; typedef int WINAPI (* CasioIO_InitPtrT)(BYTE comport, int iotype); CasioIO_InitPtrT CasioIO_InitPtr; JNIEXPORT jint JNICALL Java_jni_1test_Uninit(JNIEnv *env, jclass) { return CasioIO_UninitPtr(); } JNIEXPORT jint JNICALL Java_jni_1test_Init(JNIEnv *env, jclass cl, jshort comport, jint iotype) { return CasioIO_InitPtr(comport, iotype); } void InitPointers() { HINSTANCE Library = LoadLibrary("CasioIO.dll"); CasioIO_UninitPtr = (CasioIO_UninitPtrT )GetProcAddress(Library, "CasioIO_Uninit"); if(!CasioIO_UninitPtr) { std::cout << "Failed to find CasioIO_Uninit" << std::endl; } CasioIO_InitPtr = (CasioIO_InitPtrT )GetProcAddress(Library, "CasioIO_Init"); if(!CasioIO_InitPtr) { std::cout << "Failed to find CasioIO_Init" << std::endl; } } __declspec(dllexport) BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: InitPointers(); break; case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } The above code compiles and creates a jni_test.DLL with this command line: dmc -I\j2sdk1.4.2_10\include -I\j2sdk1.4.2_10\include\win32 -mn -WD jni_test.cpp kernel32.lib You need to do something else than stc::cout << "..." in case of errors. -- Just another homepage: http://damb.dk But it's mine - Bertel |
January 19, 2007 Re: Problem with header-file | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bertel Brander | Hi! Thank you very much! That solution works fine! I got an value back from the DLL-Method to the Java-App! Thanks for the answers you wrote and for the effort! Greetings davidek |
Copyright © 1999-2021 by the D Language Foundation