tags:

views:

288

answers:

1

I wrote multi-threaded FTP uploader on C#.NET using libcurl.NET.

Everything works fine on my machine, but when I give application (exe + libcurl.dll + 2 libcurl C# binding DLLs) to my friend who is running Win64, application crashes.

After adding exception catcher to whole Main() function, I was able to get readable error message: "An attempt was made to load a program with an incorrect format (Exception from HRESULT = 0x8007000b)"

After googling for a while, I found an advice to enable unmanaged code in my project settings. I've recompiled my application and LibCurlNet.dll with this flag set but it did not help.

What can cause such problem?

+2  A: 

The libcurl.NET library is a 32bit library, so it can't be used by a 64bit application. You need to recompile your application to target the x86 platform. This will cause it to run as a 32bit app under WOW64 on 64bit operating systems.

Reed Copsey
Thank you, worked like a charm.But is there x64 version of libcurl for windows?And if not, is there any native C# alternative for it ?
mephisto123
@Dmitry: The only distributed version (http://sourceforge.net/projects/libcurl-net/) is 32bit. You could always compile your own 64bit version, though, since libcurl (not .NET) supports 64bit. That being said, there is often no reason not to target x86 in a situation like this. Unless you need to use >2GB RAM, just leave it x86, and you should be fine.
Reed Copsey