473,327 Members | 2,074 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,327 software developers and data experts.

Semi-managed 32 bit DLL library loaded by C# code on windows x64.

Hi all.

I'm having a project which includes:
1. a DLL library which consists of two crucial parts:
a) an unmanaged code with algorithms and references to other unmanaged
libraries
b) a managed wrapper

The library is compiled witch /clr switch as either 32 or 64 bit build
depending on what I need.

2. A C# interface that utilises the library (the DLL project added as a
reference)
The problem I'm facing is that I can compile all stuff successfully, x64
builds seem to kick-off fine, though x86 builds don't seem to work at
all. While launching the compiled project it ends up with the following:
The specified module could not be found. (Exception from HRESULT:
0x8007007E)

It also kept suggesting that this has something to do with mscorlib.dll.
but then I contrived something with debugging and it stopped showing this :/

Anyway, the same problem arises when I attempt to use 32 bit DLL library
in C# code compiled for 64 bit library. In a nutshell:
32 DLL + 32 C# = error
32 DLL + 64 C# = the same error which is OK here
64 DLL + 32 C# = as above
64 DLL + 64 C# = works just fine

Anyway, the project used to run on windows x86 in the past and it was
fine. As far as I can spot, there is a number of posts about the issue,
though I haven't found any explicit answer how to tackle this. So, if
you have any suggestions ...
Thanks in advance,
Peter
Jun 27 '08 #1
6 2201
I'm having a project which includes:
1. a DLL library which consists of two crucial parts:
a) an unmanaged code with algorithms and references to other unmanaged
libraries
Just to give you more details:
- platform: XP x64
- visual studio 2008
- CLR 2.0, 3.0, 3.5 (all fail me in the same way)
Jun 27 '08 #2
I had problems loading a DLL dynamically on x64 so I had to mark my project
to build as x86 and then it worked.
--
Pete
=========================================
I use Enterprise Core Objects (Domain driven design)
http://www.capableobjects.com/
=========================================
Jun 27 '08 #3
I had problems loading a DLL dynamically on x64 so I had to mark my project
to build as x86 and then it worked.
Lol, looks this is opposite situation in my case. I set up the DLL to
x86 and C# code to x86, though now it clashes. So far I've read there
may be the problem with the assemblies. It does definitely behave like
it mixed x64 with x86 at some stage ....

Erm, this previous message while launching was:
Troubleshooting Exceptions: System.BadImageFormatException

which is said here
http://msdn.microsoft.com/en-us/libr...fe(VS.80).aspx

to be caused by C# running as x64. Though, in my case I've all set up as
x86!! ://
Jun 27 '08 #4
Anyway, the same problem arises when I attempt to use 32 bit DLL library
in C# code compiled for 64 bit library. In a nutshell:
32 DLL + 32 C# = error
32 DLL + 64 C# = the same error which is OK here
64 DLL + 32 C# = as above
64 DLL + 64 C# = works just fine

I've just created a dummy DLL that doesn't have any references to any
other unmanaged libraries. Just a dummy unmanaged part and a wrapper. It
turns out this works fine when attached to C# x86. Now, how is it
possible that the 32 bit DLL with references to other unmanaged
libraries doesn't work with C# 32 bit compiled code? Any chance it
refers to some x64 library by mistake or so .... ?
Jun 27 '08 #5
I once had a problem with an unmanaged dll that was compiled for x86.
I compiled the dll once for x86 and once for x64 and then used a
Factory
to provide the correct unmanaged dll depending on the IntPtr.Size
property

This solved my problem and de-coupled all the code I wrote on top of
it,

Regards,
Joachim

Jun 27 '08 #6
Hiyah, thanks for the reply. See, the problem is that I have a DLL
(compiled as x86 with /clr) with references to other DLL (compiled as
x86 unmanaged), then I have C# code using all this (compiled as x86) and
it behaves like it was loading somewhere x64 code ... I'm really getting
weary of all this rubbish going on here :((
I once had a problem with an unmanaged dll that was compiled for x86.
I compiled the dll once for x86 and once for x64 and then used a
Factory
to provide the correct unmanaged dll depending on the IntPtr.Size
property

This solved my problem and de-coupled all the code I wrote on top of
it,
Jun 27 '08 #7

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

Similar topics

2
by: Andrey Krivda 232973226 | last post by:
Hi! Whether there is an example where is used "Left Anti Semi Join"? andrey@tic.com.ua
2
by: Dennis M. Marks | last post by:
I am never sure of when a semi-colon is required in javascript. Is there a definite rule? -- Dennis M. Marks -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----...
7
by: jhomp ssens | last post by:
I would like to create a pulldown menu which is semi-transparent....that is, you can see the text and graphics behind it when it is pulled down. The effect I'm looking for can be seen at...
27
by: StevePBurgess | last post by:
With a string of authors such as: Carson, David, Milne, Rebecca, Pakes, Francis J., Shalev, Karen, Shawyer, Andrea I would like to write a function to change every other comma into a semi...
2
by: Trond Michelsen | last post by:
Hi. I have a transparent PNG-image that I would like to display on top of the rest of the web page. I've already got this part working. But, I'd like the background (as in "the part of the image...
2
by: James Stroud | last post by:
Hello All, I am trying to create a semi-standalone with the vendor python on OS X 10.4 (python 2.3.5). I tried to include some packages with both --packages from the command and the 'packages'...
0
by: James Arnold | last post by:
I am trying to use a semi transparent PNG as the form background, allowing you to see through certain parts. The intention is similar to a skinnable form like launchy, with semi-transparent pixels...
9
by: JamesF1982 | last post by:
Hey everyone, My question is related to HTML, Javascript, CSS and ASP.NET but i think it belongs here! Upon an event i am trying to add a semi-transparent colour across the page so the...
3
by: Sylvain | last post by:
Hi, I'm playing with Google App Engine and during my tests it seems that there is a bug in cgi. parse_header function. If we upload a file with a semi-colon (i.e : "C:/my;file.jpg") :...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.