Solved

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

Posted on 2007-11-29
3
409 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to go to Web page 2 119
Tembedded WB animatid gifs not animated on some pcs 2 80
Advice on Xojo as a development tool over VB. 4 55
aws pricing 2 46
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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.

777 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