Note that there are some explanatory texts on larger screens.

plurals
  1. POWrapping a 3rd party DLL
    text
    copied!<p>I have a 3rd party DLL that needs to be loaded dynamically using LoadLibrary() and which uses the __cdecl calling convention. I need to be able to use the dll from VB6 so I've created a wrapper DLL of my own that uses the __stdcall calling convention and exports the functions that are needed.</p> <p>An additional requirement has now arrived and I am struggling to see how to manage; the wrapped DLL provides an API to another application and I need to connect to two instances of the application concurrently. This is a problem as the DLL has no concept of a session, a typical interaction would like like this:</p> <pre><code>tpc_connect("service1") // Do some stuff tpc_disconnect() </code></pre> <p>and what i need to be able to do is</p> <pre><code>session1 = tpc_connect("service1") session2 = tpc_connect("service2") // Do some stuff with session1 // Do some stuff with session2 tpc_disconnect(session1) tpc_disconnect(session2) </code></pre> <p>The main problem as I see it is that a single process can only be conected to one service, so the first solution I tried was to move the DLL wrapper out to a seperate process by creating an Out-Of-Process COM server using ATL. The problem I now have is that I only get a single instance of the COM sever.</p> <p>So my questions (finally) are is there a way to force a new instance of the ATL COM server to be created? Is this the best approach to the problem or can someone think of a better way to tackle this.</p> <p>Thanks Jackson</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload