Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++/CLI DllMain Question

Status
Not open for further replies.

Milby7

Programmer
Dec 5, 2003
67
GB
Hi,

Is this the right forum for C++/CLI-related questions?

I haven't done any C++/CLI for ages, so please bear with me.

I have an unmanaged/native executable & I need to somehow get a managed class loaded into its process, only I don't have access to the source code of the exe. The only thing I can do is specify in a config file that it should load the dll when the process starts (presumably using LoadLibrary winapi). In other words I can't call exported functions, or create managed objects manually from the host exe...

Up until now I've been trying to get it working in C#, but it looks more & more like it's not the tool for the job, so I've gone back to C++.

I've tried a few things including getting one non-clr dll to create a thread in dllmain, waiting for dllmain to finish executing (threads to be created etc), then call an exported function on a mixed dll. either loading, or calling the mixed dll causes the process to hang... is that because the loader lock is still on?

Is what I'm trying to do even possible?

Is there a .NET equivalent to DllMain where I can safely create managed objects the library loads? Could I write another exe that shells the existing one & then somehow loads a class library into that process?

Thanks!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top