How to call in a DLL? kernel32.dll

Blitz3D Forums/Blitz3D Beginners Area/How to call in a DLL? kernel32.dll

Imperium(Posted 2013) [#1]
I want to use something like kernel32.decls to benchmark my applications memory usage. But I have no idea how to call in a DLL?

http://www.blitzbasic.com/codearcs/codearcs.php?code=1180
Here is what I need but am I supposed to make this into a DLL myself?


Yasha(Posted 2013) [#2]
Copy all of that code into a file named "kernel32.decls", and save it in your Blitz3D/userlibs folder. Restart the IDE (or find the "refresh definitions" button in IDEal).

There are two components needed to link to a DLL: the DLL itself, and a file to tell the Blitz3D compiler about the desired functions so it can find them and link them. The DLL is, in this case, a Windows component and will be present on every PC, so you don't need to copy it (and in fact your Windows licence makes doing so illegal); Blitz3D can find and link to DLLs in your Windows system folder, in your userlibs folder, or in your project root folder (the .decls must always go in userlibs/ though). DLLs that aren't system ones will need to be packaged with your application when it is built.

You can hide them in subfolders as well, by adding a subfolder to the relative path in the .lib directives within the .decls file (obviously irrelevant for kernel32 and other system files, which have a specific place to be found).