First of all, your explanation of possible malfunction of
is wrong. If a DLL is loaded, it behaves like a normal executable module with all its static memory preserved, so you can consider that its internal state, if any, is preserved during execution. There is nothing you should take care of.
It is not clear why would you obtain the access to these two functions using
. You could P/Invoke them exactly as you did it with
themselves; and it would be more reliable approach.
Finally, if you have a printer that can work via TCP, you could fully use it through the class
]. It would not require P/Invoke at all and be fully portable, work on any OS.
I assumed it's given, but maybe it won't hurt to remind you, that is a standard printer device, you could install it in the system in a standard way and use it in your applications as any other printer.