Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-11-29
3
Medium Priority
?
415 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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…
Simple Linear Regression
Progress

609 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