What exactly is a wrapper? How do programmers make them?
For example, if I have a DLL that was developed in C++ how would a wrapper be made for it to work in PureBasic(if this is even really needed)?
Wrappers, what are they and how do they work?
Wrappers, what are they and how do they work?
▓▓▓▓▓▒▒▒▒▒░░░░░
- netmaestro
- PureBasic Bullfrog

- Posts: 8452
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: Wrappers, what are they and how do they work?
A decent-sized dll will have constants, structures and exported functions in it, maybe macros and resources too such as graphics. To use the functions you'll need to know their prototypes (number and type of parameters in what order and return type), as well as what the constants and structures are and the location, size and type of any resources. A wrapper defines all these things within your program with a list and/or enumerations of the constants, declarations for the structures, any macros, prototypes for the functions and locations/sizes for the resources. With the wrapper included to your source, all you have to do is open the dll via OpenLibrary or Import, and from there you can just use it.
BERESHEIT
Re: Wrappers, what are they and how do they work?
Here are two good examples:
http://depts.washington.edu/augcomm/ima ... rapper.jpg
and
http://2.bp.blogspot.com/_Gp1LHTLo_L0/S ... .meltz.jpg
Hope those help.
http://depts.washington.edu/augcomm/ima ... rapper.jpg
and
http://2.bp.blogspot.com/_Gp1LHTLo_L0/S ... .meltz.jpg
Hope those help.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: Wrappers, what are they and how do they work?
http://www.chocablog.com/wp-content/upl ... 07/mm1.jpg
Yo, scratch-scratch, I'm em-n-em, the candy (w)rapper!
Let's pretend PB didn't support doubles. If you wanted to use a dll with functions that take doubles as parameters you would need a wrapper. This wrapper could be another dll, which exports functions similar to the ones found in the first dll, except with float parameters instead of doubles. Then the wrapper would convert from float to double and call the real dll.
Yo, scratch-scratch, I'm em-n-em, the candy (w)rapper!
Let's pretend PB didn't support doubles. If you wanted to use a dll with functions that take doubles as parameters you would need a wrapper. This wrapper could be another dll, which exports functions similar to the ones found in the first dll, except with float parameters instead of doubles. Then the wrapper would convert from float to double and call the real dll.
Re: Wrappers, what are they and how do they work?
http://en.wikipedia.org/wiki/Wrapper_libraryNituvious wrote:What exactly is a wrapper? How do programmers make them?
http://en.wikipedia.org/wiki/Wrapper_function
"Have you tried turning it off and on again ?"
Re: Wrappers, what are they and how do they work?
▓▓▓▓▓▒▒▒▒▒░░░░░
Re: Wrappers, what are they and how do they work?
Apologies, but I was struggling with a big inter-department budget-related fight, and I needed some light entertainment... (un)fortunately
you came along 
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )

