What is a DLL

Blitz3D Forums/Blitz3D Beginners Area/What is a DLL

luke101(Posted 2004) [#1]
Hello, I know this might be a stupid question but I am just trying to figure what exactly is a DLL file? Can we use them in Blitz?? What would be a reason to use them in Blitz??


WolRon(Posted 2004) [#2]
DLL
Dynamic Link Library

Basically, it's machine code that is not in an executable file but can be run from any other executable file by being called through the use of functions.

Each .dll file is made up of at least one function that can be called to do some action of some sort (such as changing the text in the titlebar of your program or updating the text in the statusbar, or creating a popup message, etc., etc., etc.). Most .dll files contain many functions that can be useful. People usually use them to perform functions that they normally cannot do from the programming language they are using (such as Blitz) or just because they don't feel like reinventing the wheel (if there's already a function for it, why write your own?).

There are tons of .dlls that each have functions to do different things. Windows uses many .dlls to save harddrive space by not having redundant code in each executable.

You can call the functions from any .dll file that exists on your computer even though you didn't write the file.

If you wish, you can create your own .dlls too that your own programs could each access. Say for example you have written several games that can each access a website and upload the high score for each game. Instead of having that code included in each game you could just write a .dll with that code and then only install that .dll file if it doesn't already exist on the end users computer when they install any of your games. Each game would share the .dll file.

Blitz doesn't have the ability to create .dll files but you can use another program, such as Visual C++.


luke101(Posted 2004) [#3]
is visual c++ the only compiler that has the ability to create dlls


luke101(Posted 2004) [#4]
Also are we able to use dlls in blitz??


Koriolis(Posted 2004) [#5]
is visual c++ the only compiler that has the ability to create dlls
No, nor is C++ the only language in which you can program DLLs. AFAIK even PureBasic allows to create DLLs. And for the C++ compilers, you can use the DevC++ IDE. It is free and comes with MingW, which can produce DLLs.

Also are we able to use dlls in blitz??
Yes, look in the "spec and utils" tab on this site, there is a "user libs format" section. Basically, a "user lib" is just DLL together with a little file (a *.decls file) that allows Blitz to use this DLL (with this you can call the DLL functions just like blitz functions).