By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,825 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,825 IT Pros & Developers. It's quick & easy.

Allowing Third Parties to Develop Code Without Access to EXE

P: n/a
Hi,

I have a VB.NET EXE which needs to remain in house. We would like to
have outside people code modules that can be dynamically loaded and
used by our EXE. We can place the requirement on the external modules
that they be managed if needed.

I am assuming we would want them to create DLL's. I can load these
dynamically with LoadLibrary and access functions using GetProcAddress
and Marshal.GetDelegateForFunctionPointer.

HERE'S THE TWO THINGS I DON'T KNOW:

1. What's the most common way to provide structures to use for the
calls? In C++ I would provide a header file with the definitions. Is
there a similar concept in VB.NET?

2. How can I make it so that their module can call specific functions
in my EXE? Since they don't have the EXE, I'm assuming it needs to
involve late binding to allow compilation.
a. Should I pass function pointers on initialization?
b. Or, should they use some variation of LoadLibrary to access the
EXE?
c. Is there any solution that would allow Intellisense to display the
functions on their machine (again, similar to providing a C++ header
with the external dynamic function definition).

Any help is appreciated on any of those points!

Gary Geniesse
NeuroDimension, Inc.
Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 2008-04-25, GaryGen <ga**@garygen.comwrote:
Hi,

I have a VB.NET EXE which needs to remain in house. We would like to
have outside people code modules that can be dynamically loaded and
used by our EXE. We can place the requirement on the external modules
that they be managed if needed.

I am assuming we would want them to create DLL's. I can load these
dynamically with LoadLibrary and access functions using GetProcAddress
and Marshal.GetDelegateForFunctionPointer.

HERE'S THE TWO THINGS I DON'T KNOW:

1. What's the most common way to provide structures to use for the
calls? In C++ I would provide a header file with the definitions. Is
there a similar concept in VB.NET?

2. How can I make it so that their module can call specific functions
in my EXE? Since they don't have the EXE, I'm assuming it needs to
involve late binding to allow compilation.
a. Should I pass function pointers on initialization?
b. Or, should they use some variation of LoadLibrary to access the
EXE?
c. Is there any solution that would allow Intellisense to display the
functions on their machine (again, similar to providing a C++ header
with the external dynamic function definition).

Any help is appreciated on any of those points!

Gary Geniesse
NeuroDimension, Inc.
Gary,

What your describing is a plug-in. Usually, like you said, is done as
dll's that the 3rd party supplies.

There is no need for the use of LoadLibrary - as long as these dll's are
managed, and I suggest that make sure they are. And, if your using .NET
3.5 - there is already a plug-in architechture in place for you - take a
look at System.AddIn.

If your using an earlier version of .NET, then you have to build your
own. Plug-in's are usually contract based - so, you would create an
intermediate dll, that would be referenced by your applicaiton and the
3rd party dll. This dll would provide all of the interfaces, types, etc
that the plug-in developer needs to interact with your application
(hence, you get intellisense). You application, then uses one of the
System.Reflection.Assembly.Load methods to load the dll at runtime.
This is really simple - until you want to actually isolate your
application from 3rd party weirdness or have the ability to dynamically
unload the library at runtime... Then you need to load the dll into
it's own AppDomain - and take some special care not accidently reference
types from that dll in you main domain - or the assembly will be loaded
into your main AppDomain. This is actually harder then it sounds...
Once this is accomplished, the result will be that all communication
with the 3rd party libary is marshalled between appdomains - giving you
isolation, but slightly degraded performance because of the cross
appdomain marshalling.

So... The short of it is, if you using 3.5, be grateful and look into
System.AddIn. If your not - let me know. I have implemented a
dynamic plugin system before, and I can probably post some sample code
for you :)

--
Tom Shelton
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.