473,397 Members | 1,985 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,397 software developers and data experts.

Managed/unmanaged 32 bit DLL and 32 bit C# under windows x64 compatibilityissues.

Hi all.

Can you please tell me if you have any problems to use managed C++ DLL
libraries that wrap some code from unmanaged external DLL 32 bit
libraries? If you called such managed 32 bit DLL from C# 32 bit code
under Windows x64 environment, would it all clash?

Can you confirm if this configuration works out for you? I'm really
puzzled whether this is some configuration bug going on here, or more
profound issue.

Cheers,
Peter.
Jun 27 '08 #1
7 4453
On Jun 19, 5:50*pm, A n g l e r <p|k|o|n|i|u|...@h-o-t-m-a-i-l.c_o_m>
wrote:
Can you please tell me if you have any problems to use managed C++ DLL
libraries that wrap some code from unmanaged external DLL 32 bit
libraries? If you called such managed 32 bit DLL from C# 32 bit code
under Windows x64 environment, would it all clash?
It should work, but do not forget to explicitly set the target
platform of your C# project to 32-bit ("x86"). Problems with P/Invoke
and COM interop to 32- bit unmanaged libraries on 64-bit platforms are
very often associated with forgetting to set this property. If you do
not do that, your C# project will try to run in 64-bit mode, and then
die with an exception the moment it tries to invoke 32-bit code.
Jun 27 '08 #2
>Can you please tell me if you have any problems to use managed C++ DLL
>libraries that wrap some code from unmanaged external DLL 32 bit
libraries? If you called such managed 32 bit DLL from C# 32 bit code
under Windows x64 environment, would it all clash?
Are you referring to /Platform:X86 and /MACHINE:X86 ? I did it on both
and still get this sick effect like it was trying to mix 32 and 64 bit
codes. This happens when I start calling external 32 bit LIB from the
managed 32 bit DLL ... I'm not sure whether this triggers some hidden
dependences or what ... ?
Jun 27 '08 #3
Are you referring to /Platform:X86 and /MACHINE:X86 ? I did it on both
and still get this sick effect like it was trying to mix 32 and 64 bit
codes. This happens when I start calling external 32 bit LIB from the
managed 32 bit DLL ... I'm not sure whether this triggers some hidden
dependences or what ... ?
Actually, I reckon it happens somewhere on a joint with C# as I've tried
to compile a similar project with 32 bit DLLs provided (so didn't
compile them on the x64 machine). The only bit compiled here is C# code
utilising the DLL. And guess what, it crashes in the same way although
it's fully configured for 32 bit platform. Blooming C# - I haven't seen
such a mess in ages :///////
Jun 27 '08 #4
A n g l e r wrote:
>>Can you please tell me if you have any problems to use managed C++
DLL libraries that wrap some code from unmanaged external DLL 32 bit
libraries? If you called such managed 32 bit DLL from C# 32 bit code
under Windows x64 environment, would it all clash?

Are you referring to /Platform:X86 and /MACHINE:X86 ? I did it on both
Yes, and it's the setting on the .exe file that counts.
and still get this sick effect like it was trying to mix 32 and 64 bit
codes. This happens when I start calling external 32 bit LIB from the
managed 32 bit DLL ... I'm not sure whether this triggers some hidden
dependences or what ... ?

Jun 27 '08 #5
Yes, and it's the setting on the .exe file that counts.

Yeah, it is on exe because it runs as 32 bit. I have checked it with the
process explorer. I'm having a sneaky suspicion this has something to do
with DLL unmanaged libraries called by this static library linked to
managed one.

I guess this may be due to some arbitrarily assumed folder locations for
a bunch of unmanaged DLL libraries that was fine in case of windows x86,
but windows x64. I dunno what else could pose this issue...
Jun 27 '08 #6
On Jun 19, 10:06*pm, A n g l e r <p|k|o|n|i|u|...@h-o-t-m-a-i-l.c_o_m>
wrote:
Yeah, it is on exe because it runs as 32 bit. I have checked it with the
process explorer. I'm having a sneaky suspicion this has something to do
with DLL unmanaged libraries called by this static library linked to
managed one.

I guess this may be due to some arbitrarily assumed folder locations for
a bunch of unmanaged DLL libraries that was fine in case of windows x86,
but windows x64. I dunno what else could pose this issue...
A 32-bit process running on Win64 should automatically load any system
DLLs from C:\WINDOWS\SysWOW64, so it shouldn't be a problem.

I've worked on project which used interop between managed and
unmanaged code (both written for the project) extensively, including
frequent callbacks between the two, and we did not have any issues
such as you describe.

Can you detail further on the nature of your managed/unmanaged calls?
Is it P/Invoke or COM interop, for starters? Are there callbacks?
Jun 27 '08 #7
Hi, I've sorted this finally out. It turned out there was a x64 library
called by another unmanaged library. Anyway, all looks good but
intellisense which keeps bugging me with some error:
There was a problem reading metadata from
'{BF5AC628-BB8E-4B99-8601-8CFE58405E9E}' ('The system cannot find the
file specified.'). IntelliSense may not work properly until the solution
is reloaded.

I've experimented a lot and it happens when managed C++ project with
references to unmanaged C++ is added as a reference to C# code. This is
the case each time I go for this sort of solution. Alternatively, if a
managed DLL is added as a reference (rather than a whole project), the
intellisense keeps quiet.

Any thoughts how to shut it up?
Thanks in advance,
Peter.
A 32-bit process running on Win64 should automatically load any system
DLLs from C:\WINDOWS\SysWOW64, so it shouldn't be a problem.

I've worked on project which used interop between managed and
unmanaged code (both written for the project) extensively, including
frequent callbacks between the two, and we did not have any issues
such as you describe.

Can you detail further on the nature of your managed/unmanaged calls?
Is it P/Invoke or COM interop, for starters? Are there callbacks?
Jun 27 '08 #8

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

Similar topics

1
by: Eric Twietmeyer | last post by:
Hello, I'm starting to investigate cs, managed c++ and interoperating with a very large unmanaged code base. We are going to use Windows Forms (written in cs) to replace our old fashioned GUI. ...
5
by: Chris Kiechel | last post by:
I am writing a .NET Windows application and it needs to perform DDE calls to a legacy system. I created a C++ unmanaged class that performs the actual DDE connection and communication. However,...
2
by: asanford | last post by:
We use StackWalk(StackWalk64) from dbghelp.dll to walk our callstacksas needed, using the various Sym* methods (SymGetSymFromAddr, SymGetLineFromAddr) to resolve source file, function name, and...
3
by: _BNC | last post by:
I have an old C DLL that I want to access via C#. I'm doing this via an outer DLL that wraps the old C DLL in an unmanaged C++ class, which is in turn wrapped in a Managed C++ class. Both these...
3
by: JoeProgrammer | last post by:
A couple of questions re. managed vs. unmanaged code. 1. I know this depends on the app, but how much faster is unmanaged code vs. managed code? Is there an average figure for this? 2. Is it as...
13
by: bonk | last post by:
Hello, I am trying to create a dll that internally uses managed types but exposes a plain unmanaged interface. All the managed stuff shall be "wrapped out of sight". So that I would be able to...
1
by: Arne Adams | last post by:
Hi, I try to use a C# Dialog in a legacy MFC application. The problem seems to boil down to the following: from an unmanaged console application I can call any function of the managed bridge - if...
25
by: Koliber (js) | last post by:
sorry for my not perfect english i am really f&*ckin angry in this common pattern about dispose: ////////////////////////////////////////////////////////// Public class...
66
by: John | last post by:
Hi What are the advantages actually achieved of managed code? I am not talking of theory but in reality. Thanks Regards
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.