fbpx
Welcome, Guest
Username: Password: Remember me
Welcome to the XSharp forum!

Tell us and our members who you are, what you like and why you became a member of this site.
We welcome all new members and hope to see you around a lot!
  • Page:
  • 1

TOPIC: Fcreate function

Fcreate function 08 Mar 2019 12:16 #7543

  • softdevo@tiscali.it's Avatar


  • Topic Author


  • Posts: 102
  • In Vo and Vulcan I could write:
    IF (ptrnew := FCreate(cFile)) = 0xFFFFFFFF //F_ERROR
    RETURN ""
    ENDIF
    Now the Fcreate function returns VOID, how can I handle the error?

    Thank you

    Danilo

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

    Fcreate function 08 Mar 2019 12:28 #7544

  • robert's Avatar

  • robert


  • Posts: 1731
  • Danilo,
    It returns a pointer just like in VO.
    What makes you think it returns a VOID ?

    Robert
    XSharp Development Team
    The Netherlands

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

    Fcreate function 08 Mar 2019 12:31 #7545

  • lumberjack's Avatar

  • lumberjack


  • Posts: 683
  • Danilo,
    Which version of X#? It seems you might not have Bandol 9... From ILSpy:
    // XSharp.Core.Functions
    public static method FCreate(cFile as string ) as IntPtr
    	return FCreate2(cFile, 0u)
    ______________________
    Johan Nel
    George, South Africa

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

    Fcreate function 08 Mar 2019 16:21 #7567

  • softdevo@tiscali.it's Avatar


  • Topic Author


  • Posts: 102
  • Hi Robert,
    So it gives me error
    LOCAL ptrnew AS PTR
    IF (ptrnew := FCreate(cFile)) = 0xFFFFFFFF //F_ERROR
    RETURN ""
    ENDIF

    error XS0019: Operator '==' cannot be applied to operands of type 'void*' and 'dword' 198,4
    Compilation failed (1 error)

    So instead it works
    LOCAL ptrnew AS DWORD
    IF (ptrnew := FCreate(cFile)) = 0xFFFFFFFF //F_ERROR
    RETURN ""
    ENDIF

    Danilo

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

    Fcreate function 08 Mar 2019 16:26 #7568

  • softdevo@tiscali.it's Avatar


  • Topic Author


  • Posts: 102
  • Version X# Bandol beta 9 (2.0.0.9)

    I solved that:

    LOCAL ptrnew AS DWORD // Not PTR
    IF (ptrnew := FCreate(cFile)) = 0xFFFFFFFF //F_ERROR
    RETURN ""
    ENDIF

    Danilo

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

    Fcreate function 08 Mar 2019 17:52 #7571

  • robert's Avatar

  • robert


  • Posts: 1731
  • Danilo,
    I think F_ERROR needs to be redefined inside the runtime. It is now defined as :
    DEFINE F_ERROR := -1
    but it should become
    DEFINE F_ERROR = new IntPtr(-1);

    Will change that for the next build.
    Then you can change the code back and use F_ERROR instead of the 0xFFFFFFFF

    Robert
    XSharp Development Team
    The Netherlands

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

    • Page:
    • 1