Re: Linking to a .NET dll from C#

Tech-Archive recommends: Fix windows errors by optimizing your registry



Cor,

The application is for a destination gateway that a client is using for obtaining price quotes and performance is absolutely critical. The users of this data will all be on the same computer per the client's request (trust me on this issue - I am aware that other price servers usually use a socket connection to communicate price updates to clients on other machines). I suppose another way to do it would be to use shared memory or memory mapped files.

In the past when using VC++, I believe we used COM and called CreateInstance on the object which would return a pointer to the object and then method calls were very efficient - like makiing a virtual method call in C++. This was many years ago though so I'm a little rusty and don't remember if we used a different technique to actually link to an existing dll or not. The question is - can something like this be done in a managed .NET language like C#, and if so what is the best way? Should we consider using com interop for this? Thought com was dead...

Bob

"Cor Ligthert[MVP]" <Notmyfirstname@xxxxxxxxx> wrote in message news:e7b69YJxJHA.1212@xxxxxxxxxxxxxxxxxxxxxxx
Bob,

Has this any goal, I did this when memory in Dos was limited to 640Kb (and there was absolute nothing more for a program despite all kinds of extended memory possibilities)

But now I don't see any reason anymore for that.

I am curious why you want this.

Cor

"Bob Bryan" <RobertGBryanREMOVETHIS@xxxxxxx> wrote in message news:7A86E279-6A12-4627-8EAA-B84124960B97@xxxxxxxxxxxxxxxx
I am trying to find out if its possible to do the following from C#:

1. Determine if a certain managed .NET dll or assembly is loaded into memory or not. If not, then load it.

2. If the dll is already loaded, then get a reference to it so that its members can be called directly. The apps that will be using the dll already knows all the methods.

3. There are several apps (exes) that will be using the dll and I'm wondering if there is a way to dynamically link to a specific dll that is already in memory and get back a reference (or pointer) that will be just as fast as if each app had used static linking.

Can this be done, if so an example or link would be appreciated.


.



Relevant Pages

  • Re: Linking to a .NET dll from C#
    ... for obtaining price quotes and performance is absolutely critical. ... be to use shared memory or memory mapped files. ... Be aware that in these scenarios you're responsible for patching and updates, as the application will no longer rely on the clients machine to keep the framework up to date. ... Determine if a certain managed .NET dll or assembly is loaded ...
    (microsoft.public.dotnet.general)
  • Memory Allication (Managed VC++ to Unmanaged DLL)
    ... Simple question on memory allocation. ... Current in on the client side of the application, ... I've tried so far using new, and malloc in a managed VC++ DLL .. ... How do I allocate a memory block in a managed VC++ ...
    (microsoft.public.dotnet.framework.interop)
  • Basic question
    ... How does an executable can run code of a DLL after the latter is loaded in ... How can a COM object communicate to its client in another process? ...
    (microsoft.public.vc.atl)
  • Re: MFC Extension DLL problem
    ... I created a DLL to make use of a preexisting MFC application. ... I assume I have a memory leak somewhere. ... > for the DLL and one for my client application. ... So the DLL allocates and the client app frees the memory. ...
    (microsoft.public.vc.mfc)
  • Re: MFC Extension DLL problem
    ... > If I now start using a dialog from the DLL I get an Debug Assertion ... I assume I have a memory leak somewhere. ... > for the DLL and one for my client application. ... So the DLL allocates and the client app frees the memory. ...
    (microsoft.public.vc.mfc)