Posts

Showing posts with the label Microsoft

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.  ...

Create C Program with Dynamic Link Library (DLL) using Visual Studio 2012 (Implicit Link)

Image
The following procedure is to create a C program with a dynamic link library using Microsoft Visual Studio Express 2012. 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 without...

Create C Program with Static Library using Command Line in Windows

Image
The following procedure is to create C program with static library using Microsoft Visual Studio Express 2012 command prompt. For brief introduction to software library, please refer to the previous post Create C Program with Static Library using Visual Studio . Click here for procedure of creating a C program using Visual Studio . Example: The following example is a normal C program with functions without using any custom static library.  #include <stdio.h> #define PI 3.1415; double PowerOf2 (double UserNumber); double PowerOf3 (double UserNumber); double CircleArea (double UserRadius); double CircleCircum (double UserRadius); int main ( ) { double p2 = 10.0; double p3 = 5.0; double radius = 4.0; printf ("The number %.2f to the power of 2 is %.2f. \n", p2, PowerOf2(p2)); printf ("The number %.2f to the power of 3 is %.2f. \n", p3, PowerOf3(p3)); printf ("A circle with a radius of %.2f, the area is %.2f. \n", radius, CircleArea(...

Create C Program with Static Library using Visual Studio 2012

Image
The following procedure is to write and compile C program with a static library using Microsoft Visual Studio 2012 Express edition. For instruction on creating a basic C program using Visual Studio, please refer to the document here . Brief Introduction to Software Library A software library is a collections of previously written functions or program which can be reused. A C program always includes a  standard file called stdio.h. This file is the header file that describe all the pre-written function such as printf that comes with the compiler. This library file is also known as the system library. Library file that are created by users are called custom library. There are two types of library, static library and dynamic link library. Both library files can share their codes and function with other program. A program that link with a static library will include all the program required during compilation time. After which you can ship the execution (exe) program to the us...

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...