Click here to Skip to main content
13,295,953 members (52,256 online)
Rate this:
Please Sign up or sign in to vote.
See more:

1. I have a program ("client") written in c++ (not written by me) that is exported as a COM object. the DLL needs to be registered in the registry for it to be used...

2. Having to add some features to it, I have written a program in c# ("queue") that the client uses in some cases.

3. In order to connect them together, I have written a cpp/cli wrapper("wrapper"), that enables the use of managed code from unmanaged code.

4. Now I have: client.dll, wrapper.dll, queue.dll tat are supposed to use each other.
the c# queue compiles and works, the cpp/cli wrapper compiles and works with the queue, the client does not fail on the code using the wrapper, but failes to register output for it now. i get:

Error 15 error PRJ0050: Failed to register output. Please try enabling Per-user Redirection or register the component from a command prompt with elevated permissions. client client

(per-user redirection is enabled)

5. Some tell me it can't be done - i cannot use managed code in a COM object (even though it is in a different DLL?) and some say i can, but i need to register the other DLLs as well, so i add, in VS:
- make assembly COM visable.
- register for COM interop.

now the c# queue fails to register, here i get:

Error 91 error MSB8011: Failed to register output. Please try enabling Per-user Redirection or register the component from a command prompt with elevated permissions. C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 756 6 wrapper

any ideas?
can it be done?
does one DLL care if the DLLs it uses are managed code or unmanaged code?
is there a simple way to sort this out..?

Hope I have written all the info needed for your kind help.
Posted 17-Jul-12 23:48pm
Updated 18-Jul-12 0:11am
Sandeep Mewara 18-Jul-12 5:15am
Post comment to answerer if your update was based on what he suggested.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can make managed COM objects, if that is the question. Create it as ClassLibrary project, and project properties, in the build section set Register for COM interop.
Ron Anoshi 1-Aug-12 5:39am
well, I have added the register for COM interop, and changed some of the projects definitions, so now the client tries to use the wrapper's DLL.
but now linking fails on the row that tries to access the wrapper, with:

Error 30 error LNK2019: unresolved external symbol "int __cdecl isQueue_u(void)" (?isQueue_u@@YAHXZ) referenced in function "public: virtual long __stdcall ...::...(...*)" (?...@@UAGJPA_WPAPA_W1PAJ@Z) ....obj client

(wrote "..." over some irrelevant inner functions)

Is there a problem linking it dynamicly? how can I find out?
armagedescu 1-Aug-12 7:19am
I suppose somewhere is used isQueue, but is not exposed. Or it is exposed, but you are not using correct libs or references. You have to find the place where it is used, and see, if it is a COM object, then you have to add reference, and remove the lib which was meant to add this function. But if it is lib function, then you have to add the lib.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171207.1 | Last Updated 18 Jul 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100