Newbie - Memory sharing in COM
-
Hi, I have a doubt regarding memory sharing in a COM object. Background: Recently we shifted to VS2005. Hence the dll written in VC6 is no longer directly useful. I might have to write a COM wrapper to access this dll. The application would be working with huge files and I want only a single copy maintained across my application. The dll should actually read the file and after the error checking send the a pointer of the memory to my application. My question: 1) Is it possible to do it with COM? 2) What would happen if my COM object memory is on a remote server? 3) Does the COM object copy the memory and send it to the requested application or does it just pass the reference. My intention is to maintain a single place of memory where the file data would be read and used. Please let me know how can I achieve this through COM. Any links would be useful. Regards, Arti Gujare
-
Hi, I have a doubt regarding memory sharing in a COM object. Background: Recently we shifted to VS2005. Hence the dll written in VC6 is no longer directly useful. I might have to write a COM wrapper to access this dll. The application would be working with huge files and I want only a single copy maintained across my application. The dll should actually read the file and after the error checking send the a pointer of the memory to my application. My question: 1) Is it possible to do it with COM? 2) What would happen if my COM object memory is on a remote server? 3) Does the COM object copy the memory and send it to the requested application or does it just pass the reference. My intention is to maintain a single place of memory where the file data would be read and used. Please let me know how can I achieve this through COM. Any links would be useful. Regards, Arti Gujare
ArtiGujare wrote:
Recently we shifted to VS2005. Hence the dll written in VC6 is no longer directly useful.
I don't understand that? Your old C++ code should be able to still do the following in a VS2005 C++ project.
ArtiGujare wrote:
The dll should actually read the file and after the error checking send the a pointer of the memory to my application.
led mike
-
ArtiGujare wrote:
Recently we shifted to VS2005. Hence the dll written in VC6 is no longer directly useful.
I don't understand that? Your old C++ code should be able to still do the following in a VS2005 C++ project.
ArtiGujare wrote:
The dll should actually read the file and after the error checking send the a pointer of the memory to my application.
led mike
When I said we shifted to VS2005 I meant that the application using the dll was previosly written in VC6 and dll too was written in VC6. Now the application has to be written in VS2005 and still use the VC6 dll. My typical use case is: 1) Application send the file name to the dll. 2) dll reads the file at that mentioned filepath and does some file checks 3) if the file is in expected format, the dll returns the pointer pointing to the file data to the applictaion. I hope it looks clear now.
-
When I said we shifted to VS2005 I meant that the application using the dll was previosly written in VC6 and dll too was written in VC6. Now the application has to be written in VS2005 and still use the VC6 dll. My typical use case is: 1) Application send the file name to the dll. 2) dll reads the file at that mentioned filepath and does some file checks 3) if the file is in expected format, the dll returns the pointer pointing to the file data to the applictaion. I hope it looks clear now.
-
I see no information in there that would keep you from accomplishing that using VS2005 C++ projects.
led mike
-
What about : 2) What would happen if my COM object memory is on a remote server? 3) Does the COM object copy the memory and send it to the requested application or does it just pass the reference.
For (3): You cannot pass a reference to memory across machines, that makes no sense at all. Therefore the memory is copied. I have no idea why you are fixated on COM. Nothing in your requirments demands using COM. Without a requirement I would not choose to include the complexity and overhead associated with COM. In other words I would only use COM as a last resort.
led mike
-
For (3): You cannot pass a reference to memory across machines, that makes no sense at all. Therefore the memory is copied. I have no idea why you are fixated on COM. Nothing in your requirments demands using COM. Without a requirement I would not choose to include the complexity and overhead associated with COM. In other words I would only use COM as a last resort.
led mike
Hi Led, I tried adding the VC6dll in my VS2005App using "Add Reference". I could not add it. I got the message "A reference to "" could not be added. Please make sure that the file is accesible, and that it is a valid assembly or COM component" I googled around a bit with this message and I found that I cannot simply use the VC6dll in my VS2005App. Many links suggested that I might have to wrap the dll in a COM component in order to use it. Hence the COM usage. Otherwise if there is an alternative to bypass COM wrapping I would be more than happy to do the same. Any suggestions? Thanks and Regards, Arti Gujare
-
Hi Led, I tried adding the VC6dll in my VS2005App using "Add Reference". I could not add it. I got the message "A reference to "" could not be added. Please make sure that the file is accesible, and that it is a valid assembly or COM component" I googled around a bit with this message and I found that I cannot simply use the VC6dll in my VS2005App. Many links suggested that I might have to wrap the dll in a COM component in order to use it. Hence the COM usage. Otherwise if there is an alternative to bypass COM wrapping I would be more than happy to do the same. Any suggestions? Thanks and Regards, Arti Gujare
Is the DLL already implementing a COM object? If so then it should work no problem. I thought one of the ideas behind com was portable objects. If it's not a com DLL then there's no "Add Reference" that will load the DLL. You need to link to it (implicitely or explicitely using LoadLibrary() or similar). If it uses MFC you may have problems. If it uses the CRT you may have problems as well since you'll have mixed versions between the app and the DLL. Mark
-
Hi Led, I tried adding the VC6dll in my VS2005App using "Add Reference". I could not add it. I got the message "A reference to "" could not be added. Please make sure that the file is accesible, and that it is a valid assembly or COM component" I googled around a bit with this message and I found that I cannot simply use the VC6dll in my VS2005App. Many links suggested that I might have to wrap the dll in a COM component in order to use it. Hence the COM usage. Otherwise if there is an alternative to bypass COM wrapping I would be more than happy to do the same. Any suggestions? Thanks and Regards, Arti Gujare
ArtiGujare wrote:
I tried adding the VC6dll in my VS2005App using "Add Reference".
"Add Reference" is for adding .NET assemblies in a "Managed" Project. You are in the C++ forum indicating that your project is a "Native" project. Therefore you do not add a reference to the DLL. You link to it using a .Lib file just as before. Using a DLL from a C++ project is pretty basic stuff, why are you having problems with this? Perhaps if you give us more information about your level of experience we might provide more targeted information.
led mike