Hi all,
I have some code to be migrated from VO to X# which simulates kind of a low-level wildseek with ADS functionality.
There is a variable
LOCAL pR as Byte PTR
which is at some point calculated from another pointer (it all comes down to do something with DBF headers):
pRecBuf := memAlloc(dwBufSize + 5)
pR := pRecBuf + 4
Later this goes into a function like this
ACE.ADSGetRecord(hTbl, pR, pRS)
where the function now does expect a BYTE[] for pR - so the compiler throws an error XS1503. Can someone please point me in the right direction how to deal with pR so that all the pointer arithmetics still work?
Byte PTR
Byte PTR
Hello Stefan,
Looking at Meinhards reply in a comparable case (https://www.xsharp.eu/forum/public-vo-v ... type#20466) I'd say this could work:(not tested & not sure if it actually does with BYTE[]) but you could quickly give it a try:
Dick
Looking at Meinhards reply in a comparable case (https://www.xsharp.eu/forum/public-vo-v ... type#20466) I'd say this could work:(not tested & not sure if it actually does with BYTE[]) but you could quickly give it a try:
Code: Select all
BYTE[](_CAST, pR)
Byte PTR
Stefan,
This is difficult without seeing what you are doing with the pR.
And what are you doing with the first 4 bytes?
To allocale the byte array you could use
pBytes := Byte[]{ (INT) dwBuffSize)
If you want to keep using the ptr, you can allocate the byre array and then use Marshal.Copy() to copy the bytes to the pointer.
Robert
This is difficult without seeing what you are doing with the pR.
And what are you doing with the first 4 bytes?
To allocale the byte array you could use
pBytes := Byte[]{ (INT) dwBuffSize)
If you want to keep using the ptr, you can allocate the byre array and then use Marshal.Copy() to copy the bytes to the pointer.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
The Netherlands
robert@xsharp.eu
-
- Posts: 71
- Joined: Thu Jul 15, 2021 10:46 am
- Location: Germany
Byte PTR
Dick, Robert,
thanks, but both examples don't even compile (the Parser throws XS9002 unexpected input ')').
What finally compiles is this (based on Roberts suggestion):
pBytes := BYTE[]{dwBufSize}
ACE.ADSGetRecord(hTbl, pBytes, @dwBufSize)
System.Runtime.InteropServices.Marshal.Copy( pBytes, 0, pR, dwBufSize )
I hope this what was meant![Smile :)](https://dt9qzg9h465rt.cloudfront.net/phpBB3/images/smilies/icon_e_smile.gif)
thanks, but both examples don't even compile (the Parser throws XS9002 unexpected input ')').
What finally compiles is this (based on Roberts suggestion):
pBytes := BYTE[]{dwBufSize}
ACE.ADSGetRecord(hTbl, pBytes, @dwBufSize)
System.Runtime.InteropServices.Marshal.Copy( pBytes, 0, pR, dwBufSize )
I hope this what was meant
![Smile :)](https://dt9qzg9h465rt.cloudfront.net/phpBB3/images/smilies/icon_e_smile.gif)