embedding a COM Server in an already existing service

Ok, a question to the gurus out there, I'll make a short description of what I want to do, let's see if I'm on the right way or not...
I'm relatively new on COM, I understand how the layer works and the benefits as well as the general development concepts. My scenario follows: I've an existing application that runs as a Windows service, the application is block built, that means I already have a C++ SDK to interact with the core DLLs, I'm also looking about integrating Python, that's pretty simple, I've just to write a proxy Layer on my classes/functions, that doesn't scare me. I was thinking about the idea of giving COM and Automation support on the server itself, and here comes the doubts.
Is there a way to embed a COM/DCOM server inside my existing applicaiton ? Out-of-process and distributed servers have some kind of on-call activation managed by the SCM inside windows, what I really like to do, if that's possible, to have several methods available generally that may fail if the server is not running (or even run it on demand), but include the com logic directly inside my server. I'm almost sure I can write a standalone proxy component that interact with a local named pipe (or socket) to my main service, but this may cause me a big headache implementing my custom marshalling/unmarshalling on the server itself.
I hope what I asked is clear, and if possible, could some one point me to a working example/documentation ?

cheers.

benaclerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkrCommented:
It'd rather go the way to not use the same module as a server, since that might cause problems security-wise (the same image might have to run in two different contexts)

>>Is there a way to embed a COM/DCOM server inside my existing applicaiton ?

Ther are, but, I wouldn't do that, rather split the basic code into DLLs that serve as a COM service and also can be used by your application for th aforementioned reasons. This is just a precaution, though.

What is your service actually supposed to do?
0
benaclerAuthor Commented:
>> It'd rather go the way to not use the same module as a server, since that might cause problems security-wise (the same image might have to run in two different contexts)

I'm talking exactly about this, I don't want to run the server in two different contexts, but I would like to inject the COM calls into an already running process. Maybe I was not clear...

>> Ther are, but, I wouldn't do that, rather split the basic code into DLLs that serve as a COM service and also can be used by your application for th aforementioned reasons. This is just a precaution, though.

Again, choosing this way requires some sort of IPC betweeen the DLLs, that will run in two different contexts... that's exacty what I would like to avoid

>> What is your service actually supposed to do?
Some sort of client/server communication to process tasks, but this is out of scope, my question is general.
0
jkrCommented:
Well, thechnically, the main difference for the whole thing is that for a COM server at some point 'IClassFactory::CreateInstance()' will be called. So if you keep the initialization for both the regular service and the COM server consistent, there should not be any problem. So that basically boils down to the question if both service have enough in common to make that possible.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

jkrCommented:
OH, BTW, as a starting point: http://msdn2.microsoft.com/en-us/library/74y2334x(VS.80).aspx ("ATL Services")

(I might be carrying coals to Newcastle, though ;o)
0
benaclerAuthor Commented:
so it seams possible. Any example without ATL ?
0
jkrCommented:
A COM server without ATL? ;o) Yikes, that is going to be quite difficult. Well, there is one at http://msdn2.microsoft.com/en-us/library/a2ht8e6d.aspx ("DCOM Sample: Calls COM Object in Windows Service from Multiple Clients"), but even the sample clients are either ATL or MFC...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.