How to use DLL's?
Blitz3D Forums/Blitz3D Beginners Area/How to use DLL's?
| ||
Hey, I have heard that you can use functions of DLL files (like Win32.dll) within Blitz. How is this done? Anywhere I can read a guide/tutorial? |
| ||
There are two ways: CallDLL and Userlibs. The former is antiquated, and the latter is much more flexible. You can read the specs for userlibs under Community->Specs and Utils->Userlibs Specifications. There are also many answered questions and examples too in the Userlibs and BlitzPlus/3D forums about them. In many cases, it's very easy. For instance, if you have a Win32 DLL, then you just need to (a) find out the names of the exported functions of the DLL, (b) look up one of the function in MSDN to find out the parameters, and what versions of Windows it's supported on, (c) write a function declaration (decls file) for interfacing with the API (just one line of code), and then you can use it in Blitz. Of course you can also write your own DLLs and use their exported functions with userlibs. If you need more info about any part of the process, just ask and I (or somebody else, I'm sure) will elaborate. |
| ||
A DLL (Dynamic Linked Library) is identified by name and by the functions and subs that it containes. Different DLLs could have functons and subs with similar names as found in other DLLS, and it is necessary to know something about the DLL in order to use it. At least the name and purpose of the sub or function, which DLL it can be found in, what parameters need to be passed into it, and what gets returned when it exits. When one speaks of the Windows DLL, the reference is actually to a great many DLLs that have been developed for the operating system and for applications that run in that environment. Many of the available calls are documented as the Windows API, or Application Program Interface. These provide many of the services that programmers want to be able to call as part of their own projects. It is a big subject area, and I might suggest that you do some reaearch and study both online and off, and to look at sample code which uses some of the DLLs found on most Windows systems. The Win32API references appear in many good manuals and generally apply to DLLs that belong in Windows versions from Win95 on up to WinXP. Any 16-bit references date back to Win3.x. In the future, it is likely that the ,NET incentative will attempt to render the Win32API somewhat obsolete, but you can be assurred that these routines will be there for your use for many years to come. |
| ||
I have heard that you can use functions of DLL files (like Win32.dll) within Blitz. How is this done? Anywhere I can read a guide/tutorial? Read this for starters (helped me): http://www.blitzbasic.co.nz/bbs/posts.php?topic=22082 http://www.blitzbasic.co.nz/bbs/posts.php?topic=22132 |