Posts

Showing posts with the label compile

Create C Program with Dynamic Link Library (DLL) using Command Line (Implicit Link) in Windows

Image
The following procedure is to create a C program with a dynamic link library using Developer Command Prompt for VS2012. Brief Introduction to Dynamic Link Library (DLL) The important difference between DLL and static library is that the code of external function is stored in the DLL file, whereas when linking with static library, the code of the external functions is copied to the execution file of the application program. With static library, you just need an execution file whereas with DLL you need both the execution file and the DLL file for the program to work. Implicit or Explicit Link When creating DLL, we have the choice of implicit linking or explicit linking. Since implicit linking is easier and common, this article will focus on implicit linking. For additional information please refer to the following: Linking Implicitly Linking Explicitly Determining Which Linking Method to Use Examples: The following example is a normal C program with functions.  ...

C Programming in Mac OS X

Image
Programming C in Mac OS X requires you to install Xcode. Fortunately, this development tool is available free. Go to your App Store and search for Xcode. Install Xcode by clicking on " Free " or " Install ". Please note that the installation will take quite some time. There are two methods of writing and compiling a C program. The first method is using Xcode and the second method is using command line. Both methods require installation of Xcode. Using Command Line  To use command line to compile a C program, we need to enable gcc (or llvm-gcc). Under Xcode, select Xcode >> Preferences ,  click on the Downloads tab. You should see a line " Command Line Tools ". Click on the install button on the right. Close Xcode when you are done. You can use TextEdit to create a simple C program. Alternatively, you can also use vim from the Terminal. Open the Terminal and navigate to the folder you would like to store the program. C...

Compile and Run C Program using Visual Studio 2012 Express

Image
You can compile and run a C program using Microsoft Visual Studio 2012 Express editions. This procedure has been tested using Visual Studio Express for Desktop running on Windows 7. Windows 8 users may try this procedure provided you install Visual Studio Express for Desktop. There are two methods to run and compile a C program. The first method is using command line and the second method is using Visual Studio IDE. Compile C Program in Command Line using VS Express 1. Select Start >> All Programs >> Microsoft Visual Studio 2012 >> Visual Studio Tools >> Developer Command Prompt for VS2012 . See below. 2. Launch the "Developer Command Prompt for VS2012". 3. Navigate to the location where you wrote the program. 4. Compile the program using the command cl <program_name.c> 5. The obj file and exe file will be created using the same program name. Example: I've wrote this simple program using notepad and save...