Solved

Attach to DLL in memory, don't load new instance

Posted on 2007-11-29
3
408 Views
Last Modified: 2011-09-20
I have a database app in unmanaged code, with many DLLs. I have a web service server (managed code) that, when called, must call a function in one of the unmanaged database DLLs. That all works OK except for this: the DLL that gets called is completely uninitialized, loaded fresh from the disk. Very bad, because it really isn't part of a running program, so it blows up immediately. The DLL that I want is already in memory, running as part of the database app. There is only one DLL of that name on the computer. In the web service class declaration, I'm using something like this:

using namespace System::Runtime::InteropServices;
public class pipe
      {
      public:
      [DllImport("C:\\C32\\CPP\\PIPE.DLL",EntryPoint="WebQueryAvailable",
CharSet=CharSet::Auto)]
       static short WebQA(char*,long*);
      };

where the DLL path is spelled out. Any way to link to the DLL in memory so that this thread joins the current process?
Also, can LoadLibrary() be used to link to an unmanaged DLL from managed code? MS documentation doesn't say you can't, but it doesn't seem to work either.

Thanks for any advice.

Open in new window

0
Comment
Question by:PacificaResearch
3 Comments
 
LVL 15

Accepted Solution

by:
bpmurray earned 500 total points
ID: 20414799
LoadLibrary should be able to load an unmanaged DLL from managed code (the converse is more difficult). Have you tried LoadLibraryEx?
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21447671
Forced accept.

Computer101
EE Admin
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
A short article about a problem I had getting the GPS LocationListener working.
This video teaches users how to migrate an existing Wordpress website to a new domain.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now