It is currently October 19th, 2020, 4:14 pm

Working with multiple DLL and Rainmeter

Share and get help with Plugins and Addons
elfaus
Posts: 4
Joined: August 11th, 2015, 10:07 pm

Working with multiple DLL and Rainmeter

Post by elfaus »

Good evening everybody,

I would like to have remote sensor include in rainmeter from my server hosted by OVH and Kimsufi.
They have released a new OAuth2 API recently and as a result, I would try to make a plugin in order to query this API about some sensors.

I'm using a third party library (https://github.com/vdaron/ovhapicil) which use a third one too (Newtonsoft.JSON)
As a result, when I'm compiling my plugin project, I got 3 DLLs and don't know what can I do with them.

I was stucking a long time during my tries before thinking "hey... that happened because your plugin dll can't find its dependencies, so it's crash !"

Well, so the question is : How can I make it workable with rainmeter ?
Maybe there is a way to tell him "I want all those DLL in thise measure" ?
I think the easiest way could be to put the dependencies in System32 folder, but it's not really cute and sharable :s
User avatar
.raptor
Posts: 220
Joined: April 3rd, 2013, 11:03 pm
Location: Norway

Re: Working with multiple DLL and Rainmeter

Post by .raptor »

I'm in no way an expert on this, but as i have a working approach i use, i thought i could share.

http://stackoverflow.com/questions/189549/embedding-dlls-in-a-compiled-executable

Just followed the instructions of the top answer and it worked out of the box for me.
(Currently using it with my plugin and Newtonsoft.JSON)
elfaus
Posts: 4
Joined: August 11th, 2015, 10:07 pm

Re: Working with multiple DLL and Rainmeter

Post by elfaus »

Hey,

I got this when i generate the DLL :

Code: Select all

1>------ Début de la génération : Projet : PluginOVH, Configuration : Debug x64 ------
1>    Fody (version 1.28.3.0) Executing
1>        	Embedding 'E:\Users\elfau\Documents\Visual Studio 2015\Projects\rainmeter-plugin-sdk-master\C#\packages\Newtonsoft.Json.6.0.3\lib\net45\Newtonsoft.Json.dll'
1>        	Embedding 'E:\Users\elfau\Documents\Visual Studio 2015\Projects\Ovh.RestLib-master\Ovh.RestLib\bin\Release\Ovh.RestLib.dll'
1>        	Embedding 'E:\Users\elfau\Documents\Visual Studio 2015\Projects\Ovh.RestLib-master\Ovh.RestLib\bin\Release\Ovh.RestLib.pdb'
1>        	Embedding 'E:\Users\elfau\Documents\Visual Studio 2015\Projects\Ovh.RestLib-master\Ovh.RestLib\bin\Release\RestSharp.dll'
1>      Finished Fody 757ms.
1>  PluginOVH -> E:\Users\elfau\Documents\Visual Studio 2015\Projects\rainmeter-plugin-sdk-master\C#\PluginOVH\x64\Debug\OVH.dll
1>  E:\Users\elfau\Documents\Visual Studio 2015\Projects\rainmeter-plugin-sdk-master\C#\PluginOVH\x64\Debug\OVH.dll.il(2209) : error -- Undeclared identifier IL_000a
1>E:\Users\elfau\Documents\Visual Studio 2015\Projects\rainmeter-plugin-sdk-master\C#\PluginOVH\PluginOVH.cs(518): error : syntax error at token ':' in:     IL_000a:  call       instance void [mscorlib]System.Runtime.InteropServices.GCHandle::Free()
1>EXEC : DllExporter error : Unable to assemble!
1>  
1>  ***** FAILURE ***** 
1>  
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4713,5): error MSB3073: La commande ""E:\Users\elfau\Documents\Visual Studio 2015\Projects\rainmeter-plugin-sdk-master\C#\..\API\DllExporter.exe" "Debug" "x64" "E:\Users\elfau\Documents\Visual Studio 2015\Projects\rainmeter-plugin-sdk-master\C#\PluginOVH\x64\Debug\\" "OVH.dll"" s'est arrêtée avec le code 1.
========== Génération : 0 a réussi, 1 a échoué, 0 mis à jour, 0 a été ignoré ==========
I've just install fozy.Costura.
Should I do anything else ? :/

PS : I keep the default post build value

Code: Select all

"$(SolutionDir)..\API\DllExporter.exe" "$(ConfigurationName)" "$(PlatformName)" "$(TargetDir)\" "$(TargetFileName)"
User avatar
.raptor
Posts: 220
Joined: April 3rd, 2013, 11:03 pm
Location: Norway

Re: Working with multiple DLL and Rainmeter

Post by .raptor »

It might be this, even tho i find it weird that it wouldn't warn you before building.

Code: Select all

1>E:\Users\elfau\Documents\Visual Studio 2015\Projects\rainmeter-plugin-sdk-master\C#\PluginOVH\PluginOVH.cs(518): error : syntax error at token ':' in:     IL_000a:  call       instance void [mscorlib]System.Runtime.InteropServices.GCHandle::Free()
elfaus
Posts: 4
Joined: August 11th, 2015, 10:07 pm

Re: Working with multiple DLL and Rainmeter

Post by elfaus »

sorry, but i didn't hunderstand ^^'

on line 518 i've just have this line

Code: Select all

 [DllExport]
        public static void Finalize(IntPtr data)
        {
            GCHandle.FromIntPtr(data).Free();
#if DLLEXPORT_GETSTRING
            if (StringBuffer != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(StringBuffer);
                StringBuffer = IntPtr.Zero;
            }
#endif
        }
which is standard.

I've try to compile the DLL without the default post build value and no longer have error.
Rainmeter start well with my plugin enable but it seems something is missing since i don't have any data returned.
User avatar
.raptor
Posts: 220
Joined: April 3rd, 2013, 11:03 pm
Location: Norway

Re: Working with multiple DLL and Rainmeter

Post by .raptor »

Well, not only is this beyond me, but i missed this whole line:

Code: Select all

1>  E:\Users\elfau\Documents\Visual Studio 2015\Projects\rainmeter-plugin-sdk-master\C#\PluginOVH\x64\Debug\OVH.dll.il(2209) : error -- Undeclared identifier IL_000a
Found this link, but I'm not sure if its helpful or not. Good luck, and lets hope someone with more experience than me drops by ;-)
elfaus
Posts: 4
Joined: August 11th, 2015, 10:07 pm

Re: Working with multiple DLL and Rainmeter

Post by elfaus »

It looks more an issue with APIExporter since when I remove the postbuild line it compile well.
I've add a snk file to my project but nothing change :/