Eugeny89
Eugeny89

Reputation: 3731

Visual C++: creating a dll using libcurl

I'm developing dll that uses libcurl. After adding libcurl.dll and libidn-11.dll to dependences I get libcurl.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x308.

PS: I'm using MSVS 2010

PPS: I'd successfully compiled that dll with mingw compiler, no problems were thrown there.

Thank you in advance!

Upvotes: 2

Views: 2656

Answers (2)

Stack Overflow is garbage
Stack Overflow is garbage

Reputation: 247899

In the Windows world, access to dynamic libraries is usually done through a small static library (.lib) stub.

In VS, you'd then link against the .lib file, which contains the code necessary to load the dll at runtime.

You can't link directly against the .dll.

If you're used to Linux, this probably seems like a somewhat awkward way of doing it, but that's how it is.

So, do you have such a .lib file for your curl library? If so, link against that. If not, using curl from your VS project is going to be a bit more work. (But one option might be to just build curl with VS, which'd give you both .dll and .lib file)

Upvotes: 3

James M
James M

Reputation: 16718

Is there a libcurl.lib to accompany libcurl.dll? You're meant to link with the lib file, not the dll directly.

Upvotes: 7

Related Questions