It's not in the DLL. Check out how to do multi-threading
here. Just have a function whose job it is to open the ports by calling the DLL function (let's call it threadOpenFunc). Then I just go:
CreateThread(NULL, 0, threadPortOpenFunc, 1, 0, NULL);
I put that in its own function, actually, and it checks and sets a couple of global variables to make sure that such a thread isn't already opening on closing ports, because it would get unpredictable if you were trying to close a port in one thread while opening the same port in another thread.
Jibb