Page 1 of 2

VisualBASIC/PowerBASIC style alias command

Posted: Tue Feb 20, 2007 2:21 pm
by mr daniel reed
"Alias" would be a great feature, it's the only feature that is keeping me
from buying the full version of PureBASIC, instead of PowerBASIC.

"Alias" aliases the executable name of a function, particularly useful
for DLLs.

I would like to see this command in upcoming version of PureBASIC.

Posted: Tue Feb 20, 2007 4:18 pm
by Kaeru Gaman
it is possible to "ALIAS" commands by defining Macros....

Code: Select all

Macro Output( Expression )
  Debug Expression
EndMacro

Output("test")
a = 567
Output(a)

Posted: Tue Feb 20, 2007 4:21 pm
by Trond
"Alias" aliases the executable name of a function, particularly useful
for DLLs.

Posted: Tue Feb 20, 2007 4:28 pm
by Kaeru Gaman
erm yes.. so what?

it's just what can be done with a macro...

or do I misunderstand something?

Code: Select all

Macro MyRGB(r,g,b)
  RGB(r,g,b)
EndMacro

Macro NewWindow(Nr,x,y,width,height,title,flags = #PB_Window_SystemMenu)
  OpenWindow(Nr,x,y,width,height,title,flags)
EndMacro

Macro StartScreen(width,height,depth,title)
  OpenScreen(width,height,depth,title)
EndMacro
same is possible with DLL-Calls...

Posted: Tue Feb 20, 2007 4:34 pm
by gnozal
If you have an import library for the DLL, I guess you could use the 'As' keyword to simulate 'Alias'.

Code: Select all

Import "User32.lib"
 FindTheWindow(*ClassName, *WindowName) As "_FindWindowA"
EndImport

Debug FindTheWindow(0, @"jaPBe V3")
But using a Macro is also a good idea.

Posted: Tue Feb 20, 2007 4:52 pm
by ts-soft
Or for a DLL:

Code: Select all

Prototype EasyRequester(Message.s)

Define MyAlias.EasyRequester

If OpenLibrary(0, "PureBasic.dll")
  MyAlias = GetFunction(0, "EasyRequester")
  
  MyAlias("Hello")
  CloseLibrary(0)
EndIf

Posted: Tue Feb 20, 2007 4:54 pm
by gnozal
ts-soft wrote:Or for a DLL:

Code: Select all

Prototype EasyRequester(Message.s)

Define MyAlias.EasyRequester

If OpenLibrary(0, "PureBasic.dll")
  MyAlias = GetFunction(0, "EasyRequester")
  
  MyAlias("Hello")
  CloseLibrary(0)
EndIf
Yes !
I forgot the prototypes ...

Posted: Tue Feb 20, 2007 6:30 pm
by Brice Manuel
it's the only feature that is keeping me
from buying the full version of PureBASIC, instead of PowerBASIC.
Although PowerBasic can produce 32bit executables, PowerBasic still has a 16bit compiler. It is futile to compare a grossly outdated 16bit product with PureBasic which is a 32bit product.

Posted: Tue Feb 20, 2007 8:20 pm
by Trond
I thought it was like this:

Code: Select all

ProcedureDLL MyFunc() Alias "_CustomDecoration"
EndProcedure
That's how the alias keyword works in Pascal and it also fits the description given by mr daniel reed. Also it's not possible in PureBasic.

Posted: Wed Feb 21, 2007 2:55 am
by mr daniel reed
thought it was like this:

Code:
ProcedureDLL MyFunc() Alias "_CustomDecoration"
EndProcedure


That's how the alias keyword works in Pascal and it also fits the description given by mr daniel reed. Also it's not possible in PureBasic.
Yes, sorry if I didn't clarify enough. This is exactly what I'm talking about.
I'm needing to alias my functions like so:
?Constructor@@YAXXZ
?Destructor@@YAXXZ
?ReceiveCoreDataPtr@@YAXPAX@Z

ProcedureCDLL ReceiveCorePtr [Alias "?ReceiveCoreDataPtr@@YAXPAX@Z"] (*pCore)

Posted: Wed Feb 21, 2007 3:54 am
by mr daniel reed
Just want to add: don't call it lame if a function is not in PureBasic, and you think it should be in! Fred and the team will decide if a feature request is good enough to be added. Don't come over here with a list off functions that MUST be added because this would make PureBasic a killer app in your opinion.
No, we are not going to change this forum to "Feature Demands and MustDo lists"
Not in my opinion at all. I beleive that this function would increase the sales of PureBASIC because of the increased ammount of DarkBASIC users who would purchase it to make Third party plugins.

Posted: Thu Feb 22, 2007 12:08 pm
by Kaeru Gaman
mr daniel reed wrote:
Just want to add: don't call it lame if a function is not in PureBasic, and you think it should be in! Fred and the team will decide if a feature request is good enough to be added. Don't come over here with a list off functions that MUST be added because this would make PureBasic a killer app in your opinion.
No, we are not going to change this forum to "Feature Demands and MustDo lists"
Not in my opinion at all. I beleive that this function would increase the sales of PureBASIC because of the increased ammount of DarkBASIC users who would purchase it to make Third party plugins.
where did you quote it from?

Posted: Thu Feb 22, 2007 2:17 pm
by Trond
Some post was deleted, it was in this topic.

Posted: Thu Feb 22, 2007 6:55 pm
by mr daniel reed
I quoted that from the forum rules.

My attentions are not to create an offernsive thread, or to get my thread deleted. I'm just making a comment about a feature I would like to see
because it would be particularly useful.

Posted: Thu Feb 22, 2007 7:08 pm
by Dr. Dri
maybe with a macro ???

Dri