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 8 months 4 weeks ago #7543

  softdevo@tiscali.it's Avatar Topic Author Offline Posts: 96
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 8 months 4 weeks ago #7544

  robert's Avatar robert Offline Posts: 1364
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 8 months 4 weeks ago #7545

  lumberjack's Avatar lumberjack Away Posts: 625
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 8 months 3 weeks ago #7567

  softdevo@tiscali.it's Avatar Topic Author Offline Posts: 96
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 8 months 3 weeks ago #7568

  softdevo@tiscali.it's Avatar Topic Author Offline Posts: 96
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 8 months 3 weeks ago #7571

  robert's Avatar robert Offline Posts: 1364
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