Basic4GL, Copyright (C) 2006 Tom Mulgrew

Plugin DLLs

13-Aug-2006
Tom Mulgrew

What are plugin DLLs?

Plugin DLLs are dll files written especially for Basic4GL. When you "plug-in" a DLL, it extends the Basic4GL language, giving you new commands that you can use in your programs. For example, a plugin DLL might give you new commands to play midi files, access the CD drive, load and render 3D models, call OpenGL commands from later versions or print to a printer.

Plugin DLLs allow programmers to extend Basic4GL without having to alter the main Basic4GL source code. Anyone with a reasonable grasp of C/C++ can create a Basic4GL plugin and distribute it to other Basic4GL users.

Where can I find them?

Check the Basic4GL homepage and the Basic4GL wiki page. Note that at the time of writing, plugin DLLs are relatively new, so there are no dedicated areas for them. These will be created soon.

People often announce their DLLs in the Basic4GL discussion forum, so check there also.

How do I use them in my Basic4GL programs?

Like so:

  1. Download the plugin DLL file.
  2. Move/copy it to your Basic4GL program folder (by default this is C:\Program files\Basic4GL).
  3. Start Basic4GL, click "Program" (on the main menu) then "Plug-in Libraries..."
  4. The "Plugin chooser" window pops up. Find the plugin DLL file and click the tickbox.

If all goes well, the plugin will be installed into Basic4GL. You can now close the plugin chooser and use the new commands in your program.

If not, refer to this trouble-shooter:

Note: Plugin DLLs stay loaded for the duration of your Basic4GL session, or until you create or load a new program. Every time you create a new program, you will need to choose which plugins you wish to use for that program. When you save your program to disk, Basic4GL automatically remembers which plugins are used, and will automatically load them the next time your program is opened.

How do I know what the new commands are?

After you've placed the tick next to a plugin DLL, hover the mouse over the name of the DLL. A mouse hint window should appear listing the new commands.
This is just a rough guide however, as it doesn't tell you exactly how the commands are used or what they do. Ideally the DLL author will include instructions along with his/her DLL describing how it is used.

Standalone exes

If you create a standalone exe of a Basic4GL program that uses plugin DLLs, then you must distribute those DLLs with your standalone exe.

Are plugin DLLs safe?

Basic4GL plugin DLLs can be potentially unsafe.

Basic4GL is designed to be a safe language, and every attempt is made to ensure it is stable, and that a malicious Basic4GL program (whether written deliberately or accidentally) will not damage your system.

However, plugin DLLs are written in C/C++ and can interact directly with your system. Basic4GL cannot restrict what a plugin DLL does. If a plugin allows overwriting files in your system directory, then someone could use it to write a Basic4GL program that does exactly that.
You should also be aware that even if a plugin was written with the best intentions, it can still contain bugs that can make it, and therefore Basic4GL, unstable.

Therefore using a plugin DLL is an exercise in trust and common sense should be used.
If you know and trust the authors intentions (and programming ability) and/or if a large number of people use a DLL (and aren't complaining about it) then you can generally expect it to be safe.

Note: All plugin DLLs downloadable from the Basic4GL homepage are believed to be safe (by me, the author of Basic4GL).

How can I create my own plugin DLLs?

To create a DLL, you will need:

  1. To be reasonably confident at writing C++ code.
  2. A C++ compiler. I can recommend Codeblocks which is free.
    The Basic4GL plugin SDK contains projects for Codeblocks and the Microsoft Visual C++ 2005 compiler.
    Any other decent Windows C++ compiler should also work, but you will need to create and configure the project yourself.
  3. The Basic4GL plugin SDK. Downloadable from the Basic4GL homepage.

Further instructions are provided in the plugin SDK.