xsharp.eu • Fcreate function
Page 1 of 1

Fcreate function

Posted: Fri Mar 08, 2019 11:16 am
by softdevo@tiscali.it
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

Fcreate function

Posted: Fri Mar 08, 2019 11:28 am
by robert
Danilo,
It returns a pointer just like in VO.
What makes you think it returns a VOID ?

Robert

Fcreate function

Posted: Fri Mar 08, 2019 11:31 am
by lumberjack
Danilo,
Which version of X#? It seems you might not have Bandol 9... From ILSpy:

Code: Select all

// XSharp.Core.Functions
public static method FCreate(cFile as string ) as IntPtr
	return FCreate2(cFile, 0u)

Fcreate function

Posted: Fri Mar 08, 2019 3:21 pm
by softdevo@tiscali.it
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

Fcreate function

Posted: Fri Mar 08, 2019 3:26 pm
by softdevo@tiscali.it
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

Fcreate function

Posted: Fri Mar 08, 2019 4:52 pm
by robert
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