Fcreate function

We encourage new members to introduce themselves here. Get to know one another and share your interests.
Post Reply
User avatar
softdevo@tiscali.it
Posts: 191
Joined: Wed Sep 30, 2015 1:30 pm

Fcreate function

Post 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
User avatar
robert
Posts: 4529
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Fcreate function

Post by robert »

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

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
lumberjack
Posts: 727
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

Fcreate function

Post 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)
______________________
Johan Nel
Boshof, South Africa
User avatar
softdevo@tiscali.it
Posts: 191
Joined: Wed Sep 30, 2015 1:30 pm

Fcreate function

Post 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
User avatar
softdevo@tiscali.it
Posts: 191
Joined: Wed Sep 30, 2015 1:30 pm

Fcreate function

Post 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
User avatar
robert
Posts: 4529
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Fcreate function

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply