Hello,
I created a software some times ago, which uses some plugins to work
(which I coded also). I had problems to load those plugins as they used some
classes and functions which were compiled into the main executable. So I had
to compile them by hand, adding the main executable as reference to the
csc.exe command line. It worked.
Now, I would like to create another application which would use the
same plugin. If I link the old ones with my new software, I have an error
saying that the DLL could not be loaded. I use the Activator.GetIn stance()
function...
My question is: is there a way to share my plugins between my
applications without having to compile them each time with a difference
reference to the main executable ?
Thank you for your help !
Laurent 7 3172
Laurent,
The problem here is that you are referencing the main executable from
your plug in. The point of a plug in is to have the implementation of the
plug in be separate from that of the main program it is being included in.
By setting a reference to the main executable, you aren't decoupling the
program at all.
What you should do is take the functionality in the main executable that
is needed by the plug in and place it in a library. Then, have the plug in
and the executable reference the library.
Then, you should be able to use the plug in in each application just
fine.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Laurent Navarro" <yo*@yop.comwro te in message
news:O9******** ******@TK2MSFTN GP02.phx.gbl...
Hello,
I created a software some times ago, which uses some plugins to work
(which I coded also). I had problems to load those plugins as they used
some classes and functions which were compiled into the main executable.
So I had to compile them by hand, adding the main executable as reference
to the csc.exe command line. It worked.
Now, I would like to create another application which would use the
same plugin. If I link the old ones with my new software, I have an error
saying that the DLL could not be loaded. I use the Activator.GetIn stance()
function...
My question is: is there a way to share my plugins between my
applications without having to compile them each time with a difference
reference to the main executable ?
Thank you for your help !
Laurent
I think the proper way to support application plugins is for the
application to define Interfaces which the plugins must implement.
Then the application needs to know that the plugin exists, so it can
load it. The loading should be generic though, so that all plugins
must implement some kind of interface defined by the application.
In order to share plugins, both your applications MUST specify the same
interfaces. So you'll likely need to move the interfaces to a seperate
assembly, and each application will reference the assembly which
comtains the interfaces.
Your plugins would ONLY reference this assembly which contains the
interface definitions.
HTH
Andy
Laurent Navarro wrote:
Hello,
I created a software some times ago, which uses some plugins to work
(which I coded also). I had problems to load those plugins as they used some
classes and functions which were compiled into the main executable. So I had
to compile them by hand, adding the main executable as reference to the
csc.exe command line. It worked.
Now, I would like to create another application which would use the
same plugin. If I link the old ones with my new software, I have an error
saying that the DLL could not be loaded. I use the Activator.GetIn stance()
function...
My question is: is there a way to share my plugins between my
applications without having to compile them each time with a difference
reference to the main executable ?
Thank you for your help !
Laurent
Thanks Nicholas and Andy for your quick answer, I understand that I must
create an assembly that both the plugins and the applications will reference
when compiling.
I already created an abstract PlugIn class which is the base class for
all of my plugin (it is not only an interface as I have some functions in
it). Because I want my plugin to interact directly with the GUI of my
applications, I have a reference to my main form in the PlugIn class.
Of course, when I try to compile my abstract PlugIn class into an
assembly, it doesn't want because he can't find the reference to my main
form.
I'm begining in assemblies, what should I do ?
Thanks !
"Laurent Navarro" <yo*@yop.coma écrit dans le message de news: O9************* *@TK2MSFTNGP02. phx.gbl...
Hello,
I created a software some times ago, which uses some plugins to work
(which I coded also). I had problems to load those plugins as they used
some classes and functions which were compiled into the main executable.
So I had to compile them by hand, adding the main executable as reference
to the csc.exe command line. It worked.
Now, I would like to create another application which would use the
same plugin. If I link the old ones with my new software, I have an error
saying that the DLL could not be loaded. I use the Activator.GetIn stance()
function...
My question is: is there a way to share my plugins between my
applications without having to compile them each time with a difference
reference to the main executable ?
Thank you for your help !
Laurent
You have to rework the abstract class so that a refernce to the main
form is no longer required.
If there is something unique to your main form that's not in the normal
Form class, you could create an interface in your plugin definition
assembly, and have your plugin require it be passed an instance object
which implements that interface. Your main applicaton already has a
reference to this shared plugin definition assembly, so you can easily
make your form implement this interface. That will decouple
everything..
Andy
Laurent Navarro wrote:
Thanks Nicholas and Andy for your quick answer, I understand that I must
create an assembly that both the plugins and the applications will reference
when compiling.
I already created an abstract PlugIn class which is the base class for
all of my plugin (it is not only an interface as I have some functions in
it). Because I want my plugin to interact directly with the GUI of my
applications, I have a reference to my main form in the PlugIn class.
Of course, when I try to compile my abstract PlugIn class into an
assembly, it doesn't want because he can't find the reference to my main
form.
I'm begining in assemblies, what should I do ?
Thanks !
"Laurent Navarro" <yo*@yop.coma écrit dans le message de news: O9************* *@TK2MSFTNGP02. phx.gbl...
Hello,
I created a software some times ago, which uses some plugins to work
(which I coded also). I had problems to load those plugins as they used
some classes and functions which were compiled into the main executable.
So I had to compile them by hand, adding the main executable as reference
to the csc.exe command line. It worked.
Now, I would like to create another application which would use the
same plugin. If I link the old ones with my new software, I have an error
saying that the DLL could not be loaded. I use the Activator.GetIn stance()
function...
My question is: is there a way to share my plugins between my
applications without having to compile them each time with a difference
reference to the main executable ?
Thank you for your help !
Laurent
"Laurent Navarro" <yo*@yop.comwro te in message
news:un******** ******@TK2MSFTN GP03.phx.gbl...
I already created an abstract PlugIn class which is the base class for
all of my plugin (it is not only an interface as I have some functions in
it). Because I want my plugin to interact directly with the GUI of my
applications, I have a reference to my main form in the PlugIn class.
Of course, when I try to compile my abstract PlugIn class into an
assembly, it doesn't want because he can't find the reference to my main
form.
You can define an interface that the main form implements, and the interface
definition can be separated from the main application. Then at runtime you
pass your form instance, which implements the interface, to your plugin.
-- Alan
Laurent,
You should still do what I recommended.
What you need to do is create an interface that the main form will
implement which exposes the functionality. Then, you pass that interface
definition to your plug in. Of course, the interface is defined in the
assembly that is referenced by the plug in and the main application.
Either that, or pass the type System.Windows. Forms.Form to your plug in,
instead of the typed version.
It's actually a really bad idea to allow plug ins free reign like this.
You should have a constrained set of functionality that the form implements
and exposes through the interface definition and then pass that to your plug
in.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Laurent Navarro" <yo*@yop.comwro te in message
news:un******** ******@TK2MSFTN GP03.phx.gbl...
Thanks Nicholas and Andy for your quick answer, I understand that I
must create an assembly that both the plugins and the applications will
reference when compiling.
I already created an abstract PlugIn class which is the base class for
all of my plugin (it is not only an interface as I have some functions in
it). Because I want my plugin to interact directly with the GUI of my
applications, I have a reference to my main form in the PlugIn class.
Of course, when I try to compile my abstract PlugIn class into an
assembly, it doesn't want because he can't find the reference to my main
form.
I'm begining in assemblies, what should I do ?
Thanks !
"Laurent Navarro" <yo*@yop.coma écrit dans le message de news: O9************* *@TK2MSFTNGP02. phx.gbl...
> Hello,
I created a software some times ago, which uses some plugins to work (which I coded also). I had problems to load those plugins as they used some classes and functions which were compiled into the main executable. So I had to compile them by hand, adding the main executable as reference to the csc.exe command line. It worked.
Now, I would like to create another application which would use the same plugin. If I link the old ones with my new software, I have an error saying that the DLL could not be loaded. I use the Activator.GetI nstance() function...
My question is: is there a way to share my plugins between my applications without having to compile them each time with a difference reference to the main executable ?
Thank you for your help !
Laurent
Thanks guy, I tried what you said and it's seems to be working !!
"Laurent Navarro" <yo*@yop.coma écrit dans le message de news: un************* *@TK2MSFTNGP03. phx.gbl...
Thanks Nicholas and Andy for your quick answer, I understand that I
must create an assembly that both the plugins and the applications will
reference when compiling.
I already created an abstract PlugIn class which is the base class for
all of my plugin (it is not only an interface as I have some functions in
it). Because I want my plugin to interact directly with the GUI of my
applications, I have a reference to my main form in the PlugIn class.
Of course, when I try to compile my abstract PlugIn class into an
assembly, it doesn't want because he can't find the reference to my main
form.
I'm begining in assemblies, what should I do ?
Thanks !
"Laurent Navarro" <yo*@yop.coma écrit dans le message de news: O9************* *@TK2MSFTNGP02. phx.gbl...
> Hello,
I created a software some times ago, which uses some plugins to work (which I coded also). I had problems to load those plugins as they used some classes and functions which were compiled into the main executable. So I had to compile them by hand, adding the main executable as reference to the csc.exe command line. It worked.
Now, I would like to create another application which would use the same plugin. If I link the old ones with my new software, I have an error saying that the DLL could not be loaded. I use the Activator.GetI nstance() function...
My question is: is there a way to share my plugins between my applications without having to compile them each time with a difference reference to the main executable ?
Thank you for your help !
Laurent This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: varlagas |
last post by:
We disabled the antivirus software but the problem persists. Any clues?
Many thanks in advance!
Panagiotis Varlagas
=======================================================================
2005-07-28-10.39.02.015001 Instance:DB2 Node:000
PID:1568(db2syscs.exe) TID:2440 Appid:0A00153A.C90B.050728083720
|
by: John Baker |
last post by:
Hi:
I have an application that is getting pretty bloated, and I want to develop new,
infrequently used, sections of it ( specifically special report generation) as a separate
file from the basic application. I have already split the application and data base, and
want to build the new application so that it uses the original data base, and is called by
the main application, BUT does not share any of the application code. In this way, the...
|
by: Michael McCarthy |
last post by:
I want to develop plugin support for a system.montitor module I am
working on. A lot of the modules will do mostly interop stuff for an
older system, but I want to use it myself as well to monitor event logs
and other things as I think of them...
I've seen two ways of doing this, the abstract class factory, or the
interface... the module logic is fairly simple, watch something -> get
the result -> notify / fix / and or log it...
I've...
|
by: BPearson |
last post by:
Hello
I would like to have several sites share a single web.config file. To accomplish this, I would point the root of these sites to the same folder. Is there any reason why I might not want to do this? (IIS 5 or 6
In case you're wondering why I would do this, we have many web sites on a single server, and there are groups of sites that need to share common configuration information. I'd like to ease some administration by having one...
|
by: Shikari Shambu |
last post by:
Hi All,
I have a situation where multiple applications are sharing some pages/
controls.
So, I have a separate common project that has the common pages/ controls.
My question is how do I reference these pages/ controls from my ASP.NET web
projects
WEbApp1 url http://localhost/app1 C:\Apps\App1
| |
by: qube3 |
last post by:
We have applications written by JSP/Servlet and ASP.NET. All our future
development would be based on ASP.NET.
We wants to develop a single user interface so that users would not be aware
that some of the modules they are using are implement by JSP or ASP.NET
(e.g. no need to login both JSP and ASP.NET applications)? Are there any
suggestions to share the session in formation among JSP and ASP.NET, or some
single-sign on solution.
|
by: dgiagio |
last post by:
Hi,
I'm developing an application using the C language and Python for it's
plugins. The C program connects to a MySQL database and keeps that
connection active. Is it possible to 'share' this connection with the
Python plugins? If so, is there a "standard" way to do that?
Thank you.
DG
|
by: sergio montero |
last post by:
Hi, I've been searching for books or tutorials that help to undestand
better the way plugins work and how they should be programmed, but I
just found a few articles about the basis (interfaces, assembly, etc)
I'm completly new on this subject and I'd like to be able to advance
step by step, but stable, in order to fully understand plugins and how
can I build my own plugin architecture, and build plugable applications.
Any help will be...
|
by: Peri |
last post by:
Dear All,
Is there a way in which 2 application can share a common memory location to
access static data?
Say for example I have a product master data that is available in a single
place, and I have an application that uses this data to do its own
operation. I also have a similar kind of another application that uses the
same data for its another operation. Can we implement this in C#?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |