Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #3100 > unrolled thread
| Started by | Stef <stefsxl@gmail.com> |
|---|---|
| First post | 2012-03-07 13:22 -0800 |
| Last post | 2012-03-10 19:22 +0000 |
| Articles | 6 — 4 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
C++ to VO Stef <stefsxl@gmail.com> - 2012-03-07 13:22 -0800
Re: C++ to VO "Wolfgang Riedmann" <wriedmann@gmail.com> - 2012-03-08 10:11 +0000
Re: C++ to VO Stef <stefsxl@gmail.com> - 2012-03-08 09:10 -0800
Re: C++ to VO "Wolfgang Riedmann" <wriedmann@gmail.com> - 2012-03-08 17:26 +0000
Re: C++ to VO Ronny <rmich@vub.ac.be> - 2012-03-08 02:13 -0800
Re: C++ to VO malcolm gray <malcolm.gray@ntlworld.com> - 2012-03-10 19:22 +0000
| From | Stef <stefsxl@gmail.com> |
|---|---|
| Date | 2012-03-07 13:22 -0800 |
| Subject | C++ to VO |
| Message-ID | <d35d7b68-d0b5-4a79-a062-e9adce1cf7bd@q12g2000yqg.googlegroups.com> |
I hope someone can help me with this. I am working with a dll written in C++ and have a problem with tis function C SOCmd(int iHnd, unsigned char cBus, unsigned char* cReqData, int iReqLen, unsigned char* RspData, int* iRspLen, int iDataFormat ) VO SOCmd(nHandle as Long, cBus as Long,cReqData as Usual,nReqLen As Long,RspData as String, nRspLen As Long, nDataType As Long) as Long The problem seems to be in cRecData, in a VB project it is just prototyped as a string, if I do anything else but an usual I get an unhandled exeption error. cReqData must be an null-terminated string or an array of UCHAR Hope someone has an solution.
[toc] | [next] | [standalone]
| From | "Wolfgang Riedmann" <wriedmann@gmail.com> |
|---|---|
| Date | 2012-03-08 10:11 +0000 |
| Message-ID | <9rrevaFn3U1@mid.individual.net> |
| In reply to | #3100 |
Hi Stef, > C > SOCmd(int iHnd, unsigned char cBus, unsigned char* cReqData, int > iReqLen, unsigned char* RspData, > int* iRspLen, int iDataFormat ) > > VO IMHO int is long unsigned char is byte unsigned char* is a pointer to a string local nHandle as long local cBus as byte local ptrReqData as byte ptr local nReqLen as int local nRspLen as int local nDataFormat as int local cReqData as string nReqLen = 1024 ptrReqData = MemAlloc( nReqLen ) S0Cmd( nHandle, cBus, ptrReqData, nReqLen, @nRspLen, nDataFormat ) cReqData := Mem2String( ptrReqData, nRspLen ) MemFree( ptrReqData ) HTH Wolfgang
[toc] | [prev] | [next] | [standalone]
| From | Stef <stefsxl@gmail.com> |
|---|---|
| Date | 2012-03-08 09:10 -0800 |
| Message-ID | <a314cfd3-5dc7-4d4e-b29c-967dfc52c096@gi10g2000vbb.googlegroups.com> |
| In reply to | #3109 |
Hi Wolfgang, Thanks for your answer but it did not help. SOCmd (ByVal iReaderHnd As Long, ByVal cBusAdr As Byte, ByVal cReqData As String, ByVal iReqLen As Long, ByVal cRspData As String, iRspLen As Long, ByVal iDataType As Long) As Long This is the declaration for Visual Basic and that is working, I saw it with someone working with VB. I first made the same declaration for VO but later changed it with ptr and pzs. The problem seems to be in cReqData that should contain the string value "0010" This is a command send to a Rfid reader. According to the makers VO is sending more than just "0010". cRspData should than contain the response. I do not know why sending a string in VB works and in VO not, think VO handles strings a bit different > > > C > > SOCmd(int iHnd, unsigned char cBus, unsigned char* cReqData, int > > iReqLen, unsigned char* RspData, > > int* iRspLen, int iDataFormat ) > > > VO > > IMHO int is long > unsigned char is byte > unsigned char* is a pointer to a string > > local nHandle as long > local cBus as byte > local ptrReqData as byte ptr > local nReqLen as int > local nRspLen as int > local nDataFormat as int > local cReqData as string > > nReqLen = 1024 > ptrReqData = MemAlloc( nReqLen ) > > S0Cmd( nHandle, cBus, ptrReqData, nReqLen, @nRspLen, nDataFormat ) > > cReqData := Mem2String( ptrReqData, nRspLen ) > MemFree( ptrReqData ) > > HTH > > Wolfgang
[toc] | [prev] | [next] | [standalone]
| From | "Wolfgang Riedmann" <wriedmann@gmail.com> |
|---|---|
| Date | 2012-03-08 17:26 +0000 |
| Message-ID | <9rs8egF6knU1@mid.individual.net> |
| In reply to | #3113 |
Hi Stef, not knowing the documentation of the function I couldn't say more. I tought cReqData was a return value from the function. To send only the "0010" string you should use a thing like this: local ptrString as ptr ptrString := StringAlloc( "0010" ) and free the string after the call with MemFree(). HTH Wolfgang
[toc] | [prev] | [next] | [standalone]
| From | Ronny <rmich@vub.ac.be> |
|---|---|
| Date | 2012-03-08 02:13 -0800 |
| Message-ID | <0804d057-b3c3-4c4a-bc5e-bce073d0045a@cj6g2000vbb.googlegroups.com> |
| In reply to | #3100 |
Stef, What if... unsigned char cBus -> cBus AS BYTE unsigned char* cReqData -> cReqData AS PSZ unsigned char* RspData -> RspData AS PSZ What's the complete C function info ? What is it supposed to do ? Where is the complete VO _DLL Function ? I'm not curious, but I like to know everything. VO 2.8 help contains info about these datatypes. Pls search there, for example, "Strong typing". Ronny. On 7 mrt, 22:22, Stef <stef...@gmail.com> wrote: > I hope someone can help me with this. > > I am working with a dll written in C++ and have a problem with tis > function > > C > SOCmd(int iHnd, unsigned char cBus, unsigned char* cReqData, int > iReqLen, unsigned char* RspData, > int* iRspLen, int iDataFormat ) > > VO > SOCmd(nHandle as Long, cBus as Long,cReqData as Usual,nReqLen As > Long,RspData as String, nRspLen As Long, nDataType As Long) as Long > > The problem seems to be in cRecData, in a VB project it is just > prototyped as a string, > if I do anything else but an usual I get an unhandled exeption error. > cReqData must be an null-terminated string or an array of UCHAR > > Hope someone has an solution.
[toc] | [prev] | [next] | [standalone]
| From | malcolm gray <malcolm.gray@ntlworld.com> |
|---|---|
| Date | 2012-03-10 19:22 +0000 |
| Message-ID | <1SN6r.172678$R65.162446@newsfe04.ams2> |
| In reply to | #3100 |
On 07/03/2012 21:22, Stef wrote: > I hope someone can help me with this. > > I am working with a dll written in C++ and have a problem with tis > function > > C > SOCmd(int iHnd, unsigned char cBus, unsigned char* cReqData, int > iReqLen, unsigned char* RspData, > int* iRspLen, int iDataFormat ) > > VO > SOCmd(nHandle as Long, cBus as Long,cReqData as Usual,nReqLen As > Long,RspData as String, nRspLen As Long, nDataType As Long) as Long First comment - you have not named a calling convention in either the VO or C case > The problem seems to be in cRecData, in a VB project it is just > prototyped as a string, > if I do anything else but an usual I get an unhandled exeption error. > cReqData must be an null-terminated string or an array of UCHAR Second comment is that you are telling us nothing about the values you are passing I would probably pass memory buffers and declare the parameters as PSZ or PTR rather than string (as the VO type string and the VB type string do not behave the same [as they are different types])
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web