VisualBASIC/PowerBASIC style alias command

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
mr daniel reed
New User
New User
Posts: 7
Joined: Tue Feb 20, 2007 2:19 pm

VisualBASIC/PowerBASIC style alias command

Post 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.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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)
oh... and have a nice day.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

"Alias" aliases the executable name of a function, particularly useful
for DLLs.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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...
oh... and have a nice day.
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post 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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Post 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 ...
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Brice Manuel

Post 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.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
mr daniel reed
New User
New User
Posts: 7
Joined: Tue Feb 20, 2007 2:19 pm

Post 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)
mr daniel reed
New User
New User
Posts: 7
Joined: Tue Feb 20, 2007 2:19 pm

Post 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.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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?
oh... and have a nice day.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Some post was deleted, it was in this topic.
mr daniel reed
New User
New User
Posts: 7
Joined: Tue Feb 20, 2007 2:19 pm

Post 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.
Dr. Dri
Enthusiast
Enthusiast
Posts: 243
Joined: Sat Aug 23, 2003 6:45 pm

Post by Dr. Dri »

maybe with a macro ???

Dri
Post Reply