473,382 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Error calling 32 bit COM (C++) dll from C# console application from 64 bit machine

HI,
I have some question about using unmanaged 32 bit COM (C++) dll with
C# . We use Visual Studio 2005 to develop this C# dll on 64 bit
machine.
(1) When I call the C# dll built with ANY CPU option (which use the 32
bit COM (C++) dll) from C# console application (built with ANY CPU
option), it returns below error while I create new for 32 bit COM dll,

FYI, the ExOWAClient is C# dll where I add the reference for 32 bit
COM dll.

System.Runtime.InteropServices.COMException was unhandled

Message="Retrieving the COM class factory for component with CLSID
{5F56FA52-1A76-4776-B90A-24FF9030A1D4} failed due to the following
error: 80040154."

Source="ExOWAClient"

ErrorCode=-2147221164

StackTrace:

at ExOWAClient.ExRestoreShortcut.RestoreShortcutMessa ge(String
owaId, String emailAddress) in C:\Project2\ExOWAClient\ExOWAClient
\ExRestoreShortcut.cs:line 44

at TestOwaClient.Program.Main(String[] args) in C:
\Project2\OWAForm\TestOwaClient\TestOwaClient\Prog ram.cs:line 12

at System.AppDomain.nExecuteAssembly(Assembly assembly,
String[] args)

at
Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()

at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)

at System.Threading.ThreadHelper.ThreadStart()

I try P/invoke but it does not work with COM dll either.
There is a work around by building whole application with 32 bit
option (CPU), and it works for my testing enviornment, but it is NOT a
real option for me.
I have to build application using Any CPU (means 64 bit) by calling 32
bit COM dll.
Also, I can not build my 32 bit COM dll with 64 bit either due to some
reson.

I really appreciate your response.

Aug 16 '07 #1
1 4897
"ashish" <an*******@gmail.comwrote in message
news:11**********************@i38g2000prf.googlegr oups.com...
HI,
I have some question about using unmanaged 32 bit COM (C++) dll with
C# . We use Visual Studio 2005 to develop this C# dll on 64 bit
machine.
(1) When I call the C# dll built with ANY CPU option (which use the 32
bit COM (C++) dll) from C# console application (built with ANY CPU
option), it returns below error while I create new for 32 bit COM dll,

FYI, the ExOWAClient is C# dll where I add the reference for 32 bit
COM dll.

System.Runtime.InteropServices.COMException was unhandled

Message="Retrieving the COM class factory for component with CLSID
{5F56FA52-1A76-4776-B90A-24FF9030A1D4} failed due to the following
error: 80040154."

Source="ExOWAClient"

ErrorCode=-2147221164

StackTrace:

at ExOWAClient.ExRestoreShortcut.RestoreShortcutMessa ge(String
owaId, String emailAddress) in C:\Project2\ExOWAClient\ExOWAClient
\ExRestoreShortcut.cs:line 44

at TestOwaClient.Program.Main(String[] args) in C:
\Project2\OWAForm\TestOwaClient\TestOwaClient\Prog ram.cs:line 12

at System.AppDomain.nExecuteAssembly(Assembly assembly,
String[] args)

at
Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()

at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)

at System.Threading.ThreadHelper.ThreadStart()

I try P/invoke but it does not work with COM dll either.
There is a work around by building whole application with 32 bit
option (CPU), and it works for my testing enviornment, but it is NOT a
real option for me.
I have to build application using Any CPU (means 64 bit) by calling 32
bit COM dll.
Also, I can not build my 32 bit COM dll with 64 bit either due to some
reson.

I really appreciate your response.

Your only option is to build your managed application as 32 bit
(platform=x86), your COM dll is a 32 bit code COM server and probably has
dependencies on other 32 bit COM server dll's (OWA?). Both 64 bit and 32 bit
don't mix in the same process.
Another point is that unless you really need the addressable memory space
offered by 64 bit code, there is little or no reason to move to 64 bit,
really.

Willy.

Aug 21 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Marina Anufreichik | last post by:
Hi, After deploymnet web application on web server I can access page on local machine and login fine but when I'm trying to access web site from remote machine I can see login page, but when I'm...
2
by: Chris | last post by:
Hi, Currently, I have a console application written in C# and an unmanaged legacy DLL written in VC++ 6.0. In the DLL's previous application, when an event occurs in the DLL, a windows message...
1
by: jam | last post by:
Dear all, I ask some question before and i got some idea, like background thread.... However, I still dun know how could i start implementing this, could someone help me on this and give me some...
6
by: Mike Malter | last post by:
I am getting a error that should not be happening when I instantiate an object from my business layer in a console application within my solution. I get an "object reference not set to an...
2
by: Peter | last post by:
I've created a console application in VB.net that preforms some complex math equations. This console application is imbedded in a asp page. I want to be able to export the results of these...
0
by: andy | last post by:
Hi, I'm trying to call an SAP Rfc from my .net application using the .Net SAP connector. I have to create a console application and through that I have to call the SAP RFC. I have been able to...
6
by: Aart Nicolai | last post by:
Hi all, I have developed a vb.net console application which will run some code every seconds. To get this working I used a timer "System.Timers". When I start my console application it exits...
0
by: edwardsurjadi | last post by:
guys, i have ASP.NET website(UI) that connect to BusinessLogic(Console Application hosting the BL) through .NET Remoting on different computer. What amussing is, sometimes (very rare), the BL...
2
by: pankajprakash | last post by:
Hi All, I have a asp.net web service and I am running an .exe file though this web service. The web serivce is calling that .exe file (console application) and running the code of that console...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.