Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Coffee corner » Strange Architecture (Dll Hot load)
Strange Architecture [message #52077] Tue, 16 July 2019 12:34 Go to previous message
Xemuth is currently offline  Xemuth
Messages: 179
Registered: August 2018
Location: France
Experienced Member
Hello Everyone,

with friends we are working on a projet made with Upp ! let me quickly explain it :

SmartUppBot is a bot made for discord programmed in C++ using Upp and jjacksonRIAB discord pacakge ( https://www.ultimatepp.org/forums/index.php?t=usrinfo&id =1150&)

Since we are many to work on and the objective was to learn Upp/C++, I have made a "SmartUppBot" package contening my SmartUppBot class and a mother class named "DiscordModule".
The main idea was, everyone who would like to work on the project would have to made a new package and inherite my mother class on is package. THen I just have to create an instance of the inherited class and add it to SmartUppBot.

Let me show you :
https://i.imgur.com/ToFcG0t.png

#include <Core/Core.h>
#include "SmartBotUpp.h"

#include <Discord_Overwatch/Discord_Overwatch.h>
#include <EasyConfiguration/EasyConfiguration.h>
#include <Discord_Minecraft/Discord_Minecraft.h>
#include <Discord_RNG/Discord_RNG.h>
#include <GraphBuilder/GraphBuilder.h>
using namespace Upp;
//Module OverWatch : https://github.com/Xemuth/Discord_Overwatch
//Module Minecraft : https://github.com/Xemuth/Discord_Minecraft
//Module RNG : https://github.com/Xemuth/Discord_RNG
//Module GraphBuilder : https://github.com/Xemuth/GraphBuilder
//EasyConfiguration : https://github.com/Xemuth/EasyConfiguration

CONSOLE_APP_MAIN {
	StdLogSetup(LOG_COUT|LOG_FILE);
	EasyConfiguration ez(R"(C:/discordTokens.txt)");
	if(ez.GetCount() >= 2){
		SmartBotUpp mybot(ez.GetValue<String>("BotId"),ez.GetValue<String>("BotToken"));
	
		Discord_Overwatch ow("OverWatch","ow");
		mybot.AddModule(&ow);
	
		Discord_Minecraft mc("Minecraft","mc");
		mybot.AddModule(&mc);
	
		Discord_RNG rng("RNG", "rng");
		mybot.AddModule(&rng);
		
		mybot.Launch();
	}else{
		LOG( "config file is incorrect !\n"); 	
	}
}

As you can see every "Discord_***" is a discord module inherited from mother class. Each module have is own discord command defined "!ow" ; "!rng" ; "!mc" ...
and the bot just loop modules for each message send on Discord.

This architecture work well but every time someone update is module I must recompile everything on Linux and send it to my RaspberryPi.
That's why I was wondering if it was possible to do something like this :
https://i.imgur.com/EG7sJu0.png

Is it possible to compile modules as Dll (or linux equivalent)
and Programme SmartUppBot to allowing it to "hot load" dll located on a file and use it ?
if yes. Do this system have a limit ? is it a good way to do "clean" programme ?

Thanks for the time you taken to read this.

Best regard.

Xemuth


[Updated on: Tue, 16 July 2019 16:14]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Map implementation
Next Topic: [SOLVED]Sharing Ptr of object to dll
Goto Forum:
  


Current Time: Wed Jun 03 05:23:26 CEST 2020

Total time taken to generate the page: 0.00889 seconds