Am I doing this right?

Blitz3D Forums/Blitz3D Userlibs/Am I doing this right?

EpicElrod(Posted 2015) [#1]
I have used one underline before to make the resolution auto-adjust. It is in a file called user32.decl or something like that. When I get a new userlib, do I put it right in there, or do I make a new file?


Yasha(Posted 2015) [#2]
The compiler can see all of the .decls files in the userlibs folder (it loads them all and then ignores what you don't use), so how you split them up is up to you. Most people use one file per DLL so that they're easy to keep track of, but there might be reasons for organising your stuff a different way. Whatever makes most sense for what you're doing.

The important thing is the .lib directive, which sets the current library that the function declarations are being matched to. Every line following a .lib directive refers to functions from that library; a new .lib directive changes the current library. So every .decls file should begin with such a line, and if you want to put declarations from more than one DLL in the same file, you'll need to change the "target" DLL with a second .lib directive.

Depending on the library, you might need to put the DLL itself somewhere too. Blitz3D searches relative to:

- the current program's folder
- the userlibs folder (but only when you compile-and-run from the IDE, not when you've built an executable)
- the OS system folders (which is where it finds things like user32.dll; DO NOT put anything in here by hand; do not attempt to redistribute these yourself)

Since these searches are relative, you can hide your libraries in a local folder, e.g. libs/mydll.dll; to do this, make sure the .lib directive in the .decls file matches the relative path you want (e.g. `.lib "libs/mydll.dll"`).