Hi,
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.
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:
tpc_connect("service1")
// Do some stuff
tpc_disconnect()
and what i need to be able to do is
session1 = tpc_connect("service1")
session2 = tpc_connect("service2")
// Do some stuff with session1
// Do some stuff with session2
tpc_disconnect(session1)
tpc_disconnect(session2)
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.
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.
Thanks Jackson