Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

byte ptr/psz conversion? 29 Sep 2022 22:24 #24071

  • ic2
  • ic2's Avatar
  • Topic Author


  • Posts: 1555
  • I am converting WildSeek and used an earlier conversion which still worked in Vulcan. I come across a few XS0266 errors (Cannot implicitly convert type... which I don't know how to solve (as it is external code to me).
    ptrBlock	:= Ptr( _cast, pszBlock )

    where ptrBlock ais a Byte ptr and pszBlock a psz; error is ptr to byte
    pPszPartBuffer	:= Ptr(_cast, MemAlloc(wPartBufferLen) )

    where pPszPartBuffer is a Psz Ptr; error is psz to psz (which doesn't make sense as error message I'd say, as it looks like it's both psz.

    How should I get rid of the compiler error?

    Dick

    Please Log in or Create an account to join the conversation.

    Last edit: by ic2.

    byte ptr/psz conversion? 30 Sep 2022 00:22 #24073

    • Chris
    • Chris's Avatar


  • Posts: 3667
  • Hi Dick,

    If you enable the option "Implicit casts and conversions (/vo7)" in the Project settings/Dialect page, it should compile, I guess the vulcan project did have that enabled, too.
    But I don't think there's a need for those casts in the code, you should be able to remove them (and just leave the assignments) and the code should still run fine.

    .
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    byte ptr/psz conversion? 30 Sep 2022 11:31 #24075

    • ic2
    • ic2's Avatar
    • Topic Author


  • Posts: 1555
  • Hello Chris,

    Indeed 3 of the 4 errors disappeared with removing all cast code, which makes it at least easier to understand.
    ptrDest			:= Ptr(_cast, pPszPartBuffer)

    This line did not (I basically have no idea how you could cast something to a Byte Ptr) but the implicit option, indeed unchecked, solved also that one, thanks.

    Dick

    Please Log in or Create an account to join the conversation.

    byte ptr/psz conversion? 30 Sep 2022 16:00 #24079

    • Chris
    • Chris's Avatar


  • Posts: 3667
  • Hi Dick,

    You're welcome, just keep an eye on that code (after you have also the rest compiling) at runtime, to make sure it does work correctly when executed (no runtime errors and it does what it's supposed to do), because I do not know the context in which it runs, so am not 100% certain it will be ok.
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1