feature request, and a site question

General FreeBASIC programming questions.
Post Reply
Nexinarus
Posts: 146
Joined: May 28, 2005 6:08
Location: Everywhere
Contact:

feature request, and a site question

Post by Nexinarus »

Would be nice if functions could return type variables.
Extremely useful. Like so:

Code: Select all

function my_func(...) as my_type
dim x as my_type
...
return x
end function
Also vic, I posted this in the sourceforge tracker 'feature request' part but I figured you'd never check it. Why is there no link from freebasic.net to the project page (sourceforge.net/projects/fbc) ? Dont want people using sf.net?
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

Yeah, it's in the TODO's, but as explained before, FB follows GCC 3.x to be able to use C libs that return types, and they can be returned in many ways, depending on the fields or the size of the UDT's (they can be returned in AL, AX, EAX, EAX:EDX, ST(0) or as a pointer to the hidden parameter passed by the caller), so many changes will be needed internally to support that..

I'm redesigning the site again, sf.net page is listed in the forums page.
Nexinarus
Posts: 146
Joined: May 28, 2005 6:08
Location: Everywhere
Contact:

Post by Nexinarus »

Ah nice. How about support Basic type returns first, then c :p ?
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

There's no way to know when a prototype is a C or FB function, so if a FB function is going to return an user type, it must be done following the GCC 3.x ABI.
Nexinarus
Posts: 146
Joined: May 28, 2005 6:08
Location: Everywhere
Contact:

Post by Nexinarus »

Oh right. I just assumed you could tell a prototype was C function because it would be decalred with cdecl.
Post Reply