?
Solved

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

Posted on 2007-11-29
3
Medium Priority
?
414 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Accepted Solution

by:
bpmurray earned 2000 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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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.

752 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