Generating LIB File for DLL Library

Warning! Some information on this page is older than 3 years now. I keep it for reference, but it probably doesn't reflect my current knowledge and beliefs.

22:09
Tue
04
Jan 2011

Generating LIB File for DLL Library

I've been recently trying to use libVLC - functionality of great, codec-less VLC media player enclosed in form of DLL library. By the way I've came across a great article: GenerateLibFromDll and now I know how to generate LIB file for any DLL library! Here is detailed description of the problem:

When you have a DLL library you want to use in your C++ code, you may do it dynamically by using LoadLibrary and GetProcAddress functions from WinAPI, but it's more convenient to do it statically. But it's not enough to just #include signatures of library functions and use them in your project. You also need to link with some LIB file, even if the file is not a real static library with compiled code, but only a few-kilobyte-long list of imported functions. I believe that's just another flaw of C++ language, because other languages like for example C# don't need this even when importing functions from native DLL libraries.

If you have some SDK prepared for Visual C++ or compile the library by yourself, you also get the LIB file next to DLL. But if you have only the library, that article shows following steps to generate matching LIB:

1. From Start menu run "Visual Studio Command Prompt".

2. Execute command:

dumpbin /exports DLL_FILE.dll > DEF_FILE.def

This command prints some information about given DLL library in textual form to its standard output. We redirect it to a text file with DEF extension. But to make it real DEF file, we need to edit it.

3. Open DEF_FILE.def in some text editor and edit it to contain only the names of exported functions in form of:

EXPORTS
function_1_name
function_2_name
function_3_name
...

4. From the Visual Studio Command Prompt, execute another command:

lib /def:DEF_FILE.def /out:LIB_FILE.lib /machine:x86

And there you have it! The so much required LIB file generated from DLL library. You only need signatures of these functions with proper parameters and return values declared in some H header file and you can successfully use your DLL by linking with LIB file created by yourself :)

Comments (1) | Tags: visual studio c++ windows winapi | Author: Adam Sawicki | Share

Comments

YLQ
2017-02-22 09:41:11
of http://www.hollister-clothing.in.net/ the http://www.tory-burch.us.org/ old http://www.michaelkors.co.nl/ story. http://www.converse-shoes.net/ However, http://www.babylisspros.in.net/ when http://www.cheap-jerseys.mex.com/ a http://celine.blackfriday.in.net/ long http://www.cheap-raybansoutlet.in.net/ time http://eagles.nfljersey.us.com/ did http://www.nhl-jerseys.us.com/ not http://www.thenorth-face.ca/ remember http://www.nikeshoesoutlet.org.uk/ I http://www.kates-spade.com/ was http://www.airmax-90.org/ shocked http://www.bcbg-maxazria.ca/ to http://www.oakleys-2017.in.net/ hear http://www.oakley-sunglasses.mex.com/ the http://www.longchamp.com.de/ passage http://www.abercrombiehollister.nl/ of http://www.vans-shoes.co.uk/ time http://www.air-huaracheshoes.co.uk/ to http://www.hogan.com.de/ do http://www.supra-shoes.org/ so http://www.cheap-thomassabos.co.uk/ is http://www.nikefreeshoes-inc.co.uk/ ruthless, http://www.ghdhairstraightener.cc/ hurried http://www.givenchy.in.net/ between, http://www.coach-outletonline.ca/ chaotic http://www.michaelkors.so/ fleeting, http://www.abercrombie-kid.us.com/ for http://www.nike-air-max.com.au/ the http://www.hollister-clothingstore.com/ face, http://www.oakleyoutlet.fr/ scattered http://www.nba-shoes.com/ old http://www.air-huarache.co.uk/ year.A http://www.burberry-outletsonline.org.uk/ woman http://packers.nfljersey.us.com/ with http://www.pandora.com.de/ a http://www.abercrombie-andfitch.ca/ temperature http://www.newbalancecanada.ca/ of http://www.guessfatory.net/ not http://www.oakleysunglasses2017.com/ only http://www.monclers-outlet.us.com/ move http://bulls.nba-jersey.com/ others, http://timberwolves.nba-jersey.com/ also http://falcons.nfljersey.us.com/ touched http://www.instylers.us.org/ yourself, http://www.coachblackfriday.com/ just, http://www.michael-korshandbags.us.org/ and http://www.chi-flatiron.us.com/ aerial http://kings.nba-jersey.com/ life, http://www.the-northfaces.net.co/ everyone http://www.ralphs-laurens.co.uk/ has http://saints.nfljersey.us.com/ his http://www.swarovski-online-shop.de/ own http://www.michael-korsbags.org.uk/ Xibei http://www.mcm-handbags.org/ cold, http://www.fendi-outlet.in.net/ you http://www.michaelkors.com.se/ were http://www.christianlouboutinshoes.jp.net/ always http://www.michaelkors-canadaoutlet.ca/ a http://www.omegarelojes.es/ weak http://www.swarovski-crystals.us.com/ woman, http://texans.nfljersey.us.com/ also http://www.raybanoutlet.ca/ has http://www.cheapshoes.net.co/ its http://www.hollister-abercrombie.com.se/ own http://coachoutlet.euro-us.net/ anguish http://spurs.nba-jersey.com/ worries, http://www.oakley-outlet.net.co/ you http://chargers.nfljersey.us.com/ also http://www.converses-outlet.com/ need http://www.rolex-watches.net.co/ understand http://www.uggs-online.com/ the http://www.oakleys-outlet.it/ need http://www.longchamp.com.co/ to http://www.abercrombiefitchs.cc/ release, http://www.rayban.com.de/ we http://www.michael-korsoutlet.cc/ needed http://www.timberlands-paschere.fr/ the http://www.canadagoosesonline.com/ space. http://www.salomon-schuhe.com.de/ So http://www.cheapjerseys.us.org/ tired, http://panthers.nfljersey.us.com/ I http://www.northfaceoutlet.com.co/ allow http://www.celine-bags.org/ you http://www.timberlandbootsoutlet.us.com/ to http://www.beatsheadphone.in.net/ withdraw http://www.giuseppe-zanotti.net/ the http://www.tomsshoes-outlet.us.com/ dispute, http://www.tomsoutlet-online.net/ but http://www.tory-burchsandals.in.net/ must http://www.true-religion.com.co/ be http://www.wedding-dresses.cc/ able http://bengals.nfljersey.us.com/ to http://www.newbalanceshoes.com.es/ protect http://www.barbour-factory.com/ themselves, http://www.michaelkorsoutlet.ar.com/ but http://coach.blackfriday.in.net/ also http://www.polo-ralph-lauren.de/ allows http://www.nike-roshe-run.de/ you http://www.mcms-handbags.com/ to http://www.oakleysunglasses-canada.ca/ temporarily http://www.nikerosherun.us/ go http://www.handbagsoutlet.in.net/ into http://www.replica-handbags.net.co/ hiding, http://www.marc-jacobsonsale.com/ but http://www.swarovskissale.co.uk/ it http://www.ray-bans.net.co/ must http://www.cheap-oakleyssunglasses.com/ be http://www.michaelkors-outletonline.cc/ spring, http://www.adidas.com.se/ I http://www.the-northfaces.us.com/ think, http://www.rosheruns.us/ the http://www.cheap-michaelkors.in.net/ heart http://www.rolexwatchesforsale.us.com/ if http://www.soft-ballbats.com/ relieved http://www.timberland-boots.com.co/ to http://www.asics-shoesoutlet.com/ well http://www.oakleyoutlet.ar.com/ as http://www.beatsbydrdrephone.com/ ever, http://coach.euro-us.net/ and http://broncos.nfljersey.us.com/ only http://www.truereligions.net/ put http://www.ralphslaurenoutlet.us.com/ down http://www.michael-korsbags.co.uk/ the http://nets.nba-jersey.com/ burden, http://www.oakleyssunglasses.in.net/ all http://www.zxcoachoutlet.com/ the http://www.sunglasses-outlet.net/ way http://www.montres-pascher.fr/ Ting http://www.philipp-plein.us.com/ Feng http://www.thenorthface.com.de/ faint, http://www.mk-outletonline.us/ will http://www.ugg-boots.us.org/ go http://www.tommy-hilfiger-online.de/ easier.You http://www.levisjeans.com.co/ only http://titans.nfljersey.us.com/ live http://www.oakleys-frame.net/ once, http://www.barbour-jackets.us.com/ you http://www.raybans.org.es/ can http://www.poloralphlaurenoutlet.net.co/ not http://www.tommy-hilfiger.com.de/ live http://www.cheapjerseys.net.co/ too http://seahawks.nfljersey.us.com/ tired, http://browns.nfljersey.us.com/ should http://www.tommy-hilfigers.com/ be http://www.longchamp-handbagsoutlet.us.com/ wonderful, http://www.prada.com.de/ live http://www.vibram-fivefingers.in.net/ smart, http://www.jimmy-choos.com/ live http://www.burberrybags-sale.net/ happy! http://www.bottega-venetas.cc/ Friendship http://www.swarovskijewelrys.in.net/ is http://www.coach-factoryoutlet.net.co/ the http://rayban.blackfriday.in.net/ wine, http://www.converse.net.co/ the http://www.rayban-sunglasses.co/ more http://www.michaelkorsoutletonline.net.co/ the http://www.michael-kors.cc/ more http://www.mcmhandbags.com.co/ concentrated http://www.jimmy-chooshoes.com/ wine, http://www.burberrys-bags.net.co/ love http://www.vans-shoes.net/ is http://www.air-max.com.de/ a http://www.nikeshoes-outlet.com/ flower, http://coach-outlet.tumblr.com/ the http://www.ralph-laurenoutletonline.in.net/ more http://www.adidas.us.com/ beautiful http://coach.misblackfriday.com/ the http://www.nfljersey.us.com/ more http://www.mk-com.com/ care. http://pistons.nba-jersey.com/ Ye http://www.nikeairmaxnc.co.uk/ friendship, http://www.retro-jordans.com/ love http://www.rayban-pascher.fr/ worth http://www.coach-factoryyoutletonline.net/ mentioning, http://www.coachoutlet-online.com.co/ when http://www.cheap-rolex-watches.org.uk/ own, http://www.christianlouboutin.org.uk/ cherish http://www.burberry-outletstore.net/ after http://www.cheap-jerseys.cc/ losing, http://cavaliers.nba-jersey.com/ be http://www.airjordans.us/ yourself, http://www.nike-factorys.us/ but http://www.toryburchsale.com.co/ indulging http://www.uggboots.com.de/ in http://www.nikeair-max.es/ grief, http://pelicans.nba-jersey.com/ but http://www.basketballshoes.com.co/ in http://www.soccer-shoesoutlet.com/ the http://www.giuseppezanotti.com.co/ memories http://www.burberryonlineshop.de/ of http://www.christianlouboutinoutlet.net.co/ the http://www.nikestore.us/ past, http://redskins.nfljersey.us.com/ a http://www.juicycouture.com.co/ person http://www.uggs-onsale.net/ must http://www.cheapnhljerseys.us.com/ be http://www.adidasshoes.org.es/ a http://www.iphone-cases.net/ new http://www.airyeezy.us.com/ beginning, http://www.oakleys2016.com/ do http://www.newbalance-shoes.org/ not http://www.cheapreplica-watches.in.net/ let http://www.reebok.com.de/ the http://nuggets.nba-jersey.com/ sadness http://www.hollisterclothingstore.org/ mill http://www.burberry-handbagssale.com.co/ happy http://www.ferragamo.com.co/ factor, http://www.ralph-laurens.org.uk/ do http://www.beatsbydre.com.co/ not http://www.ralph-laurenoutletonline.com/ let http://raptors.nba-jersey.com/ the http://www.christian-louboutinshoes.in.net/ past http://www.prada-handbags.net.co/ you http://jets.nfljersey.us.com/ plug http://www.nike-air-max.com.de/ in http://www.oakleys.org.es/ sorrow http://www.ugg-bootscanada.ca/ hall. http://www.outlet-burberry.net.co/ Do http://www.pradahandbags.net.co/ not http://oakley.blackfriday.in.net/ say http://www.michael-kors-australia.com.au/ you http://www.hollisters-canada.ca/ love http://patriots.nfljersey.us.com/ who http://www.nikeskoes.dk/ you http://www.nikeair-max.ca/ are, http://www.hollisters.us.com/ life http://www.ray-bans.co.uk/ is http://www.christian-louboutins.in.net/ long, http://www.bottega-veneta.in.net/ can http://www.michael-kors.com.es/ not http://www.the-northfacejackets.co.uk/ predict http://www.p90xworkout.in.net/ tomorrow, http://www.uggs.co.nl/ good http://www.prada-shoes.com.co/ terms, http://azcardinals.nfljersey.us.com/ everyone http://www.womenclothes.in.net/ has http://www.coach-factory.in.net/ their http://www.poloralphlauren.cc/ own http://thunder.nba-jersey.com/ helplessness. http://www.ralphlauren-polos.com.co/ Not http://heat.nba-jersey.com/ live http://www.the-northface.com.co/ to http://www.tommyhilfigerca.ca/ miss http://www.toms-outlet.net/ yesterday, http://www.newoutletonlinemall.com/ but http://www.armani-exchange.in.net/ to http://www.raybans-sunglass.com/ wait http://www.burberry-handbagsoutlet.net.co/ for http://www.marc-jacobs.us.com/ hope.Girl, http://www.pandoras-charms.org.uk/ your http://longchamp.blackfriday.in.net/ tears http://www.toms-shoes.net.co/ are http://www.rayban-pas-cher.fr/ precious, http://www.longchamps.us.com/ so http://www.nikeair--max.fr/ do http://www.tory-burchoutlet.com.co/ not http://www.ugg-boots-australia.com.au/ just http://www.lacosteoutlet.us.com/ cry, http://www.adidas-superstars.nl/ your http://www.hermesbirkin-outlet.com/ training http://www.salvatoreferragamo.in.net/ is http://jaguars.nfljersey.us.com/ very http://www.newbalance-outlet.org/ important, http://www.tracksuits-store.com/ so http://knicks.nba-jersey.com/ it http://www.uggsoutlet.net.co/ should http://uggboots.misblackfriday.com/ not http://www.nike-air-max.com.se/ foul http://www.nike-max.fr/ language, http://www.bcbg-dresses.com/ your http://www.polos-ralphlauren.us.org/ youth http://www.nike-rosherun.com.es/ is http://www.asicsoutlet.us.org/ very http://magic.nba-jersey.com/ short, http://www.michael-korssale.us.com/ so http://www.mizuno-running.net/ it http://www.puma-shoes.de/ should http://www.co-aol.com/ not http://suns.nba-jersey.com/ decadent. http://www.raybans-outlet.com.co/ Girl, http://www.oakleys-sunglasses.in.net/ you http://www.ray-bansoutlet.it/ learn http://www.toms-shoe.us.com/ to http://www.ferragamoshoes.in.net/ be http://www.pandorajewellery.com.au/ alone http://airmax.misblackfriday.com/ in http://www.burberrys-outlets.org.uk/ the http://www.oakley-outletonline.com.co/ deserted http://rams.nfljersey.us.com/ corner http://www.designerhandbagsoutlet.net.co/ can http://www.mcmbackpacks.in.net/ also http://www.swarovski-australia.com.au/ be http://wizards.nba-jersey.com/ silent http://www.ralphlaurens-outlet.co.uk/ joy, http://www.truereligion-outlet.us.org/ girl, http://www.new-balance-schuhe.de/ you http://colts.nfljersey.us.com/ learn http://www.horlogesrolex.nl/ to http://www.adidas-schuheonline.de/ be http://www.coach-outletonline.net.co/ strong, http://www.barbour.in.net/ in http://www.nike-airmax.us.com/ the http://www.pandorajewelry.top/ season http://www.long-champoutlet.com/ AnShang http://www.cheap-mlbjerseys.us.com/ cross-flow, http://www.nikefree-run.net/ also http://www.ralphlauren-au.com/ can http://www.toms--outlet.com.co/ Angtou http://www.uggs-australia.com.co/ sunny, http://www.jordanrelease-dates.us.com/ girl, http://www.hugo-bossoutlet.com/ you http://www.barbour-jacketsoutlet.net/ learn http://www.dsquared2.us.com/ to http://www.rayban.co.nl/ smile, http://www.air-maxschoenen.nl/ time http://www.hermes-outlet.net.co/ to http://www.uggsstore.us.com/ give http://www.raybanssunglasses.in.net/ yourself http://www.montblancpens-sale.com/ a http://www.cheap-michaelkors.com/ smiley http://cowboys.nfljersey.us.com/ face http://www.ray-banssunglasses.org/ , http://www.versaceoutlet.us.com/ not http://www.nike-outlet.us.org/ only http://trailblazers.nba-jersey.com/ can http://www.chrome-hearts.in.net/ regulate http://www.pandoracharms-canada.ca/ mood, http://www.chiflatiron.net.co/ but http://lions.nfljersey.us.com/ also http://www.ugg-bootsclearance.com/ a http://www.juicycoutureoutlet.net.co/ way http://www.longchampoutlet.com.co/ to http://www.hermes-bags.net/ treat http://dolphins.nfljersey.us.com/ yourself. http://warriors.nba-jersey.com/ Girl, http://www.michael-kors.net.co/ although http://www.ugg-australia.com.de/ many http://www.adidas-shoes.cc/ times http://76ers.nba-jersey.com/ no http://www.oakley.com.de/ one http://www.puma-shoesoutlet.com/ can http://www.tnf-jackets.us.com/ understand http://www.monclerjackets.in.net/ your http://www.nike-air-force.de/ grief, http://www.nike-free-run.de/ but http://clippers.nba-jersey.com/ still http://ralphlauren.blackfriday.in.net/ believe http://hornets.nba-jersey.com/ that http://www.nikestore.com.de/ a http://www.nike-huaraches.nl/ warm, http://www.converse.com.de/ beautiful, http://www.rolex-watches.us.com/ trust http://www.cheapuggs-boots.com.co/ in http://ravens.nfljersey.us.com/ the http://www.valentino-shoesoutlet.us/ presence http://www.scarpe-hoganoutlets.it/ of http://www.ray-bansoutlet.in.net/ these http://www.thomas-sabo.com.de/ words, http://www.polos-outlets.com/ even http://www.nfl-jersey.us.org/ if http://vikings.nfljersey.us.com/ you http://www.ok-em.com/ remember, http://www.mcm-bags.us.org/ the http://www.nike-shoescanada.ca/ only http://raiders.nfljersey.us.com/ way http://www.adidasshoesca.ca/ to http://www.pulseraspandora.com.es/ learn http://www.omega-watches.com.co/ distressed http://www.katespades-outlet.in.net/ themselves http://49ers.nfljersey.us.com/ in http://bears.nfljersey.us.com/ order http://www.pradaoutlet.com.co/ to http://www.nikefree-run.org.uk/ make http://www.toms-shoesoutlet.us/ a http://www.michaeljordan.com.de/ good http://www.beats-by-dre.com.co/ wife, http://www.abercrombie-andfitchs.com/ good http://www.oakleys.in.net/ to http://www.nike-schuhe.com.de/ live.Eyes http://buccaneers.nfljersey.us.com/ were http://www.michael-kors-taschen.com.de/ tears http://www.canadagooses-jackets.com/ become http://www.uggs-boots.net.co/ increasingly http://jazz.nba-jersey.com/ clear, http://www.burberry-outletonline.cc/ heart http://www.adidassuper-star.de/ pain http://www.oakley--sunglasses.com.au/ due http://www.truereligionjeans.net.co/ to http://www.rosherun.co.uk/ become http://lakers.nba-jersey.com/ even http://www.christianlouboutin-shoes.ca/ more http://celtics.nba-jersey.com/ transparent, http://www.ray-banssunglasses.co.uk/ because http://www.burberryoutlets.net.co/ life http://www.airmax-2015.org/ experiences http://www.ralphlaurencanada.ca/ become http://www.burberryoutlet-sale.net/ even http://www.katespadeoutlet.gb.net/ more http://www.rolexwatches-canada.ca/ abundance. http://www.cheap-jordans.net/ Cried, http://www.burberry-outletcanada.ca/ the http://www.ralphlaurenonlineshop.de/ pain http://www.toms-outlets.us.com/ had http://www.truereligion-outlet.com.co/ gone http://www.uhren-shop.com.de/ through, http://www.jordan-shoes.com.co/ give http://www.michaelkors-bags.com.co/ yourself http://www.raybans-outlet.cc/ a http://www.hollisteronlineshop.com.de/ sunny http://www.calvin-kleins.net/ day, http://www.polos-outletstore.net/ it http://www.kate-spades.com.co/ should http://www.cheap-rayban.com.co/ be http://www.to-coachoutlet.com/ understood, http://bucks.nba-jersey.com/ to http://www.swarovski-canada.ca/ a http://www.burberryoutlet-sale.com.co/

http://www.thenorthfacejackets.fr/ http://www.soccers-shoes.net/ http://www.tommyhilfiger.net.co/ http://www.nike-skor.com.se/ http://www.designer-handbagsoutlet.us.com/ http://www.longchamp-bags.us.com/ http://bills.nfljersey.us.com/ http://www.mlb-jerseys.us.com/ http://www.vans-schuhe.com.de/ http://www.ed-hardy.us.com/ http://michaelkors.misblackfriday.com/ http://hawks.nba-jersey.com/ http://www.lauren-ralphsoutlet.co.uk/ http://www.cheapmichaelkors.us.org/ http://www.tommy-hilfiger.co.nl/ http://michaelkors.blackfriday.in.net/ http://www.timberlandshoes.net.co/ http://www.nike-tnrequinpascher.fr/ http://pacers.nba-jersey.com/ http://www.christianlouboutinshoesoutlet.org/ http://www.uggsoutlet.com.co/ http://www.insanity-workout.us.com/ http://www.cheap-baseballbats.us/ http://www.michael-kors-outlet.us.org/ http://www.oakleys-outlet.in.net/ http://www.jordanretro.org/ http://steelers.nfljersey.us.com/ http://www.cheap-nike-shoes.net/ http://www.barbours.us.com/ http://www.true-religions.com/ http://www.abercrombie-and-fitch.us.com/ http://www.michaelkorsoutlet-online.ar.com/ http://michaelkors.euro-us.net/ http://www.tommy-hilfiger.in.net/ http://www.iphone-cases.in.net/ http://www.michaelkorsbags.us.org/ http://chiefs.nfljersey.us.com/ http://rockets.nba-jersey.com/ http://www.omegawatches.in.net/ http://www.underarmour.us.com/ http://mavericks.nba-jersey.com/ http://www.uggs-boots.com.co/ http://www.nike-schoenen.co.nl/ http://www.nba-jersey.com/ http://www.the-northfacejackets.net.co/ http://www.woolrich-clearance.com/ http://www.ralph-laurenspolo.co.uk/ http://giants.nfljersey.us.com/ http://www.mbt-shoes.us.com/ http://grizzlies.nba-jersey.com/ http://www.ralph-laurenpolosoutlet.com/ http://www.nike-mercurial.in.net/ http://www.nikeshoes.org.es/ http://www.nikefree5.net/ http://www.nike-rosheruns.nl/

Post comment

Nick *
Your name or nickname
E-mail
Your contact information (optional, will not be shown)
Text *
Content of your comment
Calculate *
(* - required field)
STAT NO AD [Stat] [Admin] [STAT NO AD] [pub] [Mirror] Copyright © 2004-2017 Adam Sawicki
Copyright © 2004-2017 Adam Sawicki