I have an aplication which used to be created in Delphi 5. For various
reasons we want to try to recode that in vb .net but the original
application called functions inside one or more dlls that were loaded
dynaically by the name found at run time.
i.e. what would happen is that the application would start, it finds
all the *.dll functions available in a specified subdirectory.
The user would then select one target platform which corresponds to
one DLL from the found DLL list
That DLL is then loaded dynamically and used by the application.
The rationale is that the application then automatically picks up new
target platforms simply by adding the DLL to the appropriate
directory.
I am having problems trying to get this to run in vb .net. I can get a
single DLL to work but have to explicitly name the DLL in the source
code. In delphi I would call LoadLib and GetProcAddress and then cast
the result of GetProcAddress to a pointer to a function which would
then be used by the application. Very simple and it works. This
appears to be impossible in VB .net
Is there any way to achieve this? 3 2158
i did something simular in the past with VB6
i created several different activex dll`s with different content ( language
dependant versions , plugins ) however with all the same interface
on startup the program searched for the right dll did a create object on it
and it run just fine
well this can also be done with .Net if you investigate remoting you will
see that a simular concept is there also beeing used ( interface based )
regards
Michel Posseth
"JB" <th********@som ewhere.else> wrote in message
news:bq******** *************** *********@4ax.c om... I have an aplication which used to be created in Delphi 5. For various reasons we want to try to recode that in vb .net but the original application called functions inside one or more dlls that were loaded dynaically by the name found at run time.
i.e. what would happen is that the application would start, it finds all the *.dll functions available in a specified subdirectory. The user would then select one target platform which corresponds to one DLL from the found DLL list That DLL is then loaded dynamically and used by the application.
The rationale is that the application then automatically picks up new target platforms simply by adding the DLL to the appropriate directory.
I am having problems trying to get this to run in vb .net. I can get a single DLL to work but have to explicitly name the DLL in the source code. In delphi I would call LoadLib and GetProcAddress and then cast the result of GetProcAddress to a pointer to a function which would then be used by the application. Very simple and it works. This appears to be impossible in VB .net
Is there any way to achieve this?
JB wrote: I have an aplication which used to be created in Delphi 5. For various reasons we want to try to recode that in vb .net but the original application called functions inside one or more dlls that were loaded dynaically by the name found at run time.
Is there any way to achieve this?
One way would be to have each .dll implement a certain interface that
defines what method needs to be called. For example:
Public Interface IPlatform
Sub Execute(...)
End Interface
Then a class in the .dll will implement the interface:
Public Class Platform1
Implements IPlatform
Public Sub Execute(...) Implements IPlatform.Execu te
'Code to execute here
End Sub
End Class
Then the app that loads the .dll's can get a list of all the .dll's in
the folder, examine each one to see if it implements the IPlatform
interface and if so, instantiate the class and call the Execute method.
One caveat is that loading the assembly to check for the presence of
the interface will load the assembly and it will stay loaded until the
app shuts down. You could potentially load up many of the .dll's and
have them hanging around not being used. In .Net 2.0, there's a way to
load the assembly just for inspecting it so this is not a problem. In
1.1, you can load the assemblies in a new AppDomain and then unload the
AppDomain to unload the assemblies.
Good luck. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Muthu |
last post by:
I've read calling conventions to be the order(reverse or forward) in
which the parameters are being read & understood by compilers.
For ex. the following function.
int Add(int p1, int p2, int p3);
The parameters here can be read either in the forward order from p1
till p3 or reverse order from p3 till p1.
Can anyone explain what is the advantage/disadvantage of either of
|
by: Ross A. Finlayson |
last post by:
Hi,
I hope you can help me understand the varargs facility.
Say I am programming in ISO C including stdarg.h and I declare a
function as so:
void log_printf(const char* logfilename, const char* formatter, ...);
Then, I want to call it as so:
|
by: Jesse McGrew |
last post by:
Hi all,
I'm trying to make a plugin DLL for a third-party application, using
VC++ .NET 2003. This DLL acts as a bridge between the C++ plugin API of
the application, and my actual plugin code written in C#.
When the app calls my unmanaged functions, they work fine. But as soon
as my unmanaged functions call managed functions (in the same source
file!), the app reports an "unknown exception" error.
|
by: santosh |
last post by:
Hi,
If I call free() with a uninitialised pointer, will the program
state become undefined, or will free() return harmlessly?
Incidentally, is there a way in Standard C to determine
weather a pointer points to a valid block of allocated
memory?
Thanks for your time.
|
by: Daniel Lidström |
last post by:
I'm using a library called fyba. This library reads and writes files in a
format called sosi. fyba uses the following code to determine if the
calling process has own methods to handle errors, messages, etc:
// If this parameter is NULL,
// GetModuleHandle returns a handle of the file used
// to create the calling process.
hInstExe = GetModuleHandle( NULL );
if( hInstExe!=NULL )
| |
by: John Friedland |
last post by:
My problem: I need to call (from C code) an arbitrary C library
function, but I don't know until runtime what the function name is,
how many parameters are required, and what the parameters are. I can
use dlopen/whatever to convert the function name into a pointer to
that function, but actually calling it, with the right number of
parameters, isn't easy.
As far as I can see, there are only two solutions:
1) This one is portable. If...
|
by: ypjofficial |
last post by:
Hello All,
So far I have been reading that in case of a polymorphic class ( having
at least one virtual function in it), the virtual function call get
resolved at run time and during that the vtable pointer is made use
of..
eg.
class one
{
|
by: Ron Ford |
last post by:
K&R has three different versions of qsort, and the ultimate one is supposed
to be like the one in the std library. I'm trying to implement the first,
which is in §4.10.
I think I'm pretty close with this:
void qsort(int v, int left, int right)
{
int i, last;
|
by: unauthorized |
last post by:
The short story:
I need to be able to cast a function pointer for any function and class to an intermediate type, so I could call it from any point of my program using the "__asm call" instruction.
The long story:
I have been trying to develop a data driven method to call C++ functions, that allows calling them with minimal overhead. The final goal is to be able to call any function, by knowing just what kind of parameters to send to it....
|
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: 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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |