hi friend,
how to create and use dynamic library in c language?
thank very much.
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Nov 7, 2012, 5:41 AM EST
Go into the Visual Studio command prompt, type notepad mydll.c, enter the following code and save it:
Now type the following at the command prompt to compile this into a .dll (notice that a .lib is created at the same time though we won't need this):
cl /LD mydll.c
Next type notepad myexe.c, enter the following code and save it:
Now, type the following at the command prompt to compile this into an .exe which calls the function in the .dll at runtime:
cl myexe.c
Finally type :
myexe
to run it and you should see the following output:
Ken HRank #2,315 · 610 reputationPosted Nov 8, 2012, 1:08 AM EST
I try to follow your code, but i can not achieve, and why?
my project in Annex.
VulpesRank #55 · 29.2K reputationPosted Nov 8, 2012, 1:29 AM EST
It would really be better to do it from the command line first before trying to get it to work in VC++ 6 which is an exercise in itself :)
Ken HRank #2,315 · 610 reputationPosted Nov 8, 2012, 1:41 AM EST
thanks
VulpesRank #55 · 29.2K reputationPosted Nov 8, 2012, 6:21 AM EST
If you start VS by clicking on the Start Button and then selecting it from 'All Programs', then there may be an additional 'Visual Studio Command Prompt' option like there is in the current version.
Otherwise, it might be a menu option within VS itself - I just can't remember, I'm afraid :(
Incidentally, you can download the free VC++ 2010 Express edition from the following link if you want a more up to date edition. What I've done above definitely works in this:
http://www.microsoft.com/visualstudio/en-gb/express