harakirinox

Basics for a plugin with C++ DLL

Recommended Posts

Hello everyone,

I am currently starting the process of coding a small plugin for Overwolf that will let me display onscreen information that I gather from a DLL that I write in C++ (e.g. some information on the system's state, CPU, memory, etc... network status and more).

I had a look at the up to date plugin sample (https://github.com/overwolf/overwolf-plugin-sample), unfortunately this is in C# and I do not practice nor clearly understand this programming language (yet!).

To get started I would like to simply modify the sample plugin so when it loads it retrieves an integer from my DLL, I think if I have that working I can manage the rest.

I tried to recreate the C# DLL in C++ but it fails miserably, the plugin simply does not even load.
First I had to create a main.cpp with the DllMain entry point, otherwise my compiler was screaming to death (perhaps that might be a problem), then I recreated the general structure of the DLL but it still does not work.
Here is what I attempted:

namespace overwolf {
	namespace samples {
		namespace plugins {
			class SamplePlugin {
			public:
				int SampleProperty = 55;
				//int SampleProperty(); // Also tried to return it from a member function, didn't work
			};
		}
	}
}

I tried without the namespaces too, no more luck.
In the JavaScript files that are supposed to load the plugin (main.js) the first lines are:

// create an instance of the plugin
var plugin = new OverwolfPlugin("OverwolfSamplePlugin", true);

// initialize it
plugin.initialize(function(status) {
  // ...

Nothing past plugin.initialize gets executed so I deduce that the plugin just fails to load (the dll is in the right directory with the right name, if I place the compiled C# DLL then it does work).

Is there the equivalent of the C# sample plugin DLL in C++ somewhere?
Otherwise could anyone guide me on how to make my C++ DLL work and being able to call its functions from the HTML/JavaScript please?

I am sure that for someone used to the Overwolf's plugin system this will be easy, as there are several things that I don't quite get (I have only done standalone executable and DLL loaded "classically" from their entry point, never done a plugin before.

Thank you very much for your help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now