For new-users: What is a wrapper DLL?

Everything else that doesn't fall into one of the other PB categories.
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

For new-users: What is a wrapper DLL?

Post by josku_x »

I think many new users are getting a wrong idea of what means a 'wrapper'.

Here's an example of a 'wrapper' dll, that Fred DOES NOT want that you distribute it:

Code: Select all

ProcedureDLL PureBasic_MessageBox(Title$, Text$, Flags) 
 MessageRequester(Title$, Text$, Flags) ; <-- You see? 
EndProcedure


In that above example I just made a procedure that calls a PureBasic procedure. THis means it is a wrapper and what can you do with a wrapper? 1) You can extend the abilities of a sloppy programming language. And because of this, Fred doesn't want that people make PB wrappers, or else, you would only download a free copy of let's say Game Maker just to use the PB commandset for FREE and not paying for it, where the PB Team made a lot of hardwork.

However, a workaround to avoid wrapper's is to use API:

Code: Select all

ProcedureDLL My_MessageBox(Title$, Text$, Flags) 
 MessageBox_(0, Text$, Title$, Flags) ; <-- See? API instead of PB commands = not a wrapper. 
EndProcedure



I think this is now cleared, but there is one thing left to explain:
You CAN use PureBasic commands in your dlls, but ONLY if you don't make a wrapper. Like, this is allowed to do:

Code: Select all

ProcedureDLL OpenWebpage() 
In$=InputRequester("Open a Webpage.", "Enter an URL.", "http://") 
RunProgram(In$) 
EndProcedure
As you see that's not a wrapper, but a procedure which uses multiple PB commands to have some functionality. But remember that it is always better to use a mixture of PB and API commands, so I would do the above example like this:

Code: Select all

ProcedureDLL OpenWebpage() 
In$=InputRequester("Open a Webpage.", "Enter an URL.", "http://") 
ShellExecute_(0, "open", In$, "", "", #SW_SHOW) 
EndProcedure
I hope that people in the future will understand what Fred is meaning and that they wouldn't think that PB sucks.
Fred
Administrator
Administrator
Posts: 18352
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Hey, it does not suck, whatever other people think :P. Your example is good, and as it has been already discussed before and such topic gives endless and passionate talking, i'm locking it ;).
Locked