简体   繁体   中英

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!

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

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM