How to Compile C Code as a Library
The C programming language lets you create code for executable or dynamic link library (DLL) files. A DLL contains several functions that you can allow other users to call from other applications. You must specify that the compiler sets up a DLL file instead of an EXE file in the compiler options. You can use the cl.exe utility to compile a DLL in C.
Instructions
-
-
1
Click the Windows "Start" button and type "cmd" in the search text box. Press "Enter" to open the command prompt.
-
2
Type "cd path" where "path" is the location of your C source code file. Press "Enter" to move to the location of the file.
-
-
3
Type the following code to compile the C source code to the DLL file:
cl.exe --output myfile.dll myfile.cpp
Replace "myfile.dll" with the name of the DLL you want to use for the link file. Replace "myfile.cpp" with your own C source code file.
-
4
Press "Enter" to compile the program. After the compiler completes the creation of the DLL, type "dir" and press "Enter." You should see the DLL file in your directory.
-
1