Here's something I threw together this weekend to help anyone else interested in writing plugins for REALbasic using Visual Studio .NET 2005. Enjoy!
(Pardon the poor formatting -- it turns out that Word Press can't figure out lists embedded within lists.)
Manually creating a plugin project with VS.NET 2005
1) Creating the project
a) Select New Project
b) Pick Win32 Project, hit OK
c) When able to pick the application type, select DLL, do not add common headers for MFC or ATL, and select Export Symbols. Hit Finish
2) Cleaning things up
a) Remove stdafx.cpp and h and Read Me.txt from the project (you can delete them entirely)
b) In your project's .h file, remove all the generated code
c) Add #include "winheader++.h" and #include "rb_plugin.h", as well as an extern "C" {} block (this is where you'll be putting your exported functions
d) In your project's .cpp file, remove all the generated code.
e) Add a #include for your project's header file.
f) Add a void PluginEntry( void ) method
g) Add rb_plugin.h, REALplugin.h, winheader++.h and PluginMain.cpp from the Plugin SDK to your project
3) Configuring your settings
a) Go to Project-><project Name> Properties to begin configuring
b) Select Configuration Properties->C/C++->Preprocessor and add IGNOREQT to your Preprocessor Definitions
c) Select Configuration Properties->C/C++->Code Generation and change the Runtime Library to be Multi-threaded Debug (/MTd)
d) (Optional) You may also want to disable C++ exceptions as it adds overhead to your compiled code
e) (Optional) You may want to disable run-time type info in the Language pane as it adds overhead to your compiled code
f) Select Configuration Properties->C/C++->Precompiled Headers and set Create/Use Precompiled Header to Not Using Precompiled Headers
g) (Note) You will have to repeat these steps for the release build configuration -- the only difference is with runtime library you select. For the release configuration, it should be Multi-threaded (/MT)
4) Making your plugin
a) Add any exported functions to the extern "C" block in the header file.
b) Remember to register your exports in the PluginEntry method using the REALREgister* methods.
Happy father's day Aaron!!! oops....was this a bad way to tell you? ;)
Oh man, now I bet you'll expect flowers or some crap. ;-)
OK, now for those of us who aren't CPP wizards, do you think you could give us some example code of the 'extern "C"{}' blocks you mention, definition of global variables, methods, and events?
I took a class on CPP once, but sadly it was poorly instructed, and that's been some time ago.
Thanks
I don't expect flowers, but child support would be a good start.
@Lis -- you're so demanding. :-P
@Anthony -- An extern "C" block looks like this:
extern "C" {
void SomeFunction( void );
}
As for the methods, variables and events -- the plugins SDK has a bunch of example projects that show that sort of thing. Or are those confusing as well?
I'm also not a CPP developer. Any chance you could post a zipped up VS2005 HelloWorld plugin project as an example?
Thank you.
Sure!
Here ya go!
Great! Thank you!