Win32 DLL wrapped into COM object
-
First off, I'm a real COM neophyte....that said..... Situation: I have a win32 dll which exports approx 100 functions. These functions use data structures (some with upwards of 50 data fields) passed in/out of the function calls. All the structures have intrinsic types for fields (char*, doubles, ints bools) etc. There are no linked lists, pointer to other structures, unions etc in the structures that are passed. Requirement: I have to "wrap" this dll into a COM/ActiveX object so that the entire functionality of this dll is "visible" as a COM object. But, I really don't have a real good idea where to start with this. Do I: 1. Convert all structures to MIDL equivalents? (is there a tool for this?) 2. Create an ATL object to contain the dll and simply forward all calls to the DLL? 3. How does one convert large structured data through this kinds of mechanism? Please advise, and thank you in advance... Just trying to keep the forces of entropy at bay
-
First off, I'm a real COM neophyte....that said..... Situation: I have a win32 dll which exports approx 100 functions. These functions use data structures (some with upwards of 50 data fields) passed in/out of the function calls. All the structures have intrinsic types for fields (char*, doubles, ints bools) etc. There are no linked lists, pointer to other structures, unions etc in the structures that are passed. Requirement: I have to "wrap" this dll into a COM/ActiveX object so that the entire functionality of this dll is "visible" as a COM object. But, I really don't have a real good idea where to start with this. Do I: 1. Convert all structures to MIDL equivalents? (is there a tool for this?) 2. Create an ATL object to contain the dll and simply forward all calls to the DLL? 3. How does one convert large structured data through this kinds of mechanism? Please advise, and thank you in advance... Just trying to keep the forces of entropy at bay
Well this is not really an answer but a question. Why are you in need of wrapping this dll? Yes, I have done this. No, I didn't enjoy it. My preference is to rescope the entire project and hey just do away with the old dll if possible. If its not possible then I create a COM object that calls the other dll. Basically all calls on the old dll would be new methods on the COM object. I think you may be pushing the boundaries on the structure sizes but I am not entirely sure. If you have no requirements to use IDispatch then I would create a custom interface and just pass in the structures or pointers of structures as the case may be. You will need to look at each structure on a case by case basis to see if it is okay. You can pass the char* if you know the size. This is a big topic. I feel an article coming on. Mike "Cop" Pulice mike@puliceworx.com