Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / How To Write A TPC Plugin With PureBasic

Author
Message
D Ogre
15
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 4th Feb 2010 03:49 Edited at: 4th Feb 2010 03:53
I'm starting this thread to give the community some up to date information about writing TPC plugins with PureBasic.

I've attached a file below which contains an example that will help you build a plugin using dependencies.

File Contents:

Globstruct.pb
DBProMemblocks.pb
ExamplePlugin.pb
MyMemblock.rc
MyMemblock.res
MyMemblock.dll
MemblockFunction.txt
Test.DBPRO
PPFixer 1.2.pb
About Plugin Example.tx


GlobStruct 6.0 - this is the last latest version I have for PureBasic. It may require a few tweaks to update it to present. However, it works with the plugin example.

DBProMemblock 1.0 - this is my include file for DBPro Memblock dependency support. Setups for allowing you to use the memblock commands from within your plugin. A good framework for adding new dependecies.

ExamplePlugin 1.1 - Example framework you could use to build your own plugins.

MyMemblock RC - RC file that can be used with PurBasic for compiling the Example DLL with a string table.

MyMemblock RES - Another version of the resource file for the example. It was made with ResHack.

MYMemblock DLL - Compiled Example plugin DLL

MemblockFunction Text - Export file from the ExeScope utility that list the function names from within the DBProMemblocksDebug DLL.

Test DBPro File - A simple test program for DBPro that shows how the plugin works. Only three commands are used and supported for the example; MyMakeMemblock, MyMemblockExist, and MyDeleteMemblock.

PPFixer 1.2 - A simple PureBasic utility that fixes the plugin DLL for function name mangling.

About Plugin Example Text - Docs about my plugin example.

Feel free to share your knowledge and post any contributions you may have here.

Attachments

Login to view attachments
D Ogre
15
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 6th Feb 2010 05:05
If your having trouble using the MyMemblock.rc file with PureBasic,
open it with Notepad and delete the first line and save. That file
was generated with ExeScope which adds this unneeded line.

Also, post all your questions, comments, examples, ect. here and not
the PureGDK forum board that was stated in the ABOUT text file.
D Ogre
15
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 9th Feb 2010 01:43 Edited at: 9th Feb 2010 01:44
I've compiled a detailed set of reference files for use in building plugins
that need dependencies from the DBPro built-in command set. These files show
every command including stuff that can't be accessed directly from within the
language itself.

You can use my DBProMemblocks include file (from the above download) as a
template for extending the dependency command set for your PureBasic plugin.

Note: These reference files were generated for DBPro 7.4.

Attachments

Login to view attachments
Duffer
16
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 9th Feb 2010 20:26
@ D Ogre,

Excellent - thanks for this - opens up the possibility of perhaps coding something like PurePLUGIN pro -

Thought my purebasic assistant (for DBPro) may help:-

http://forum.thegamecreators.com/?m=forum_view&t=150031&b=8

You have to add remarks to your pb code in the YourProcedure.pb - but as long as you call your code YourProcedure.pb it automatically generates an .rc and an .ini file for it.... saves a lot of heartache...

was designed for purePLUGIN but may be of some use?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
D Ogre
15
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 10th Feb 2010 02:29
@ Duffer

Quote: "
Excellent - thanks for this - opens up the possibility of perhaps coding something like PurePLUGIN pro
"


Yes, that's the idea. Although the Pureplugin developement package is a great
framework for writing plugins with PureBasic, it has some drawbacks. Continued
support and regular updates being just a few of them.

I've briefly looked over your utility and it's usage. It seems to be a potential
gem stone. I will download it and look it over in more detail. Just a suggestion
in advance... Maybe you could add the codes from PPFixer so your utility could do
those fixes as well. This would make it more of a complete "all-in-one" tool for
PureBasic plugin developement.

Note about the plugin setup functions:

I was discussing the special plugin functions that DBPro uses during both compile
and runtime with IanM recently. I wanted to know which functions were called and in
what order.

Here's what he said:
Quote: "
Actually, my personal notes list the Constructor being called before the dependencies - TBH, I do all of my construction in the ReceiveCoreDataPtr, so it's not something that would cause me any problems.

Anyway, I've now reconfirmed the order of initialisation/teardown as:
- Constructor
- GetNumDependencies
- GetDependencyID (called once for each dependency)
- ... Window Created
- ReceiveCoreDataPtr
- ... Further internal initialisation
- ... Normal running, until user-code ends
- ... Window Destroyed
- PreDestructor
- Destructor
"

Login to post a reply

Server time is: 2019-10-15 10:07:02
Your offset time is: 2019-10-15 10:07:02