Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Programming Assignment 1 | Operating Systems | CS 570, Assignments of Operating Systems

Material Type: Assignment; Class: OPERATING SYSTEMS; Subject: Computer Science; University: San Diego State University; Term: Spring 2004;

Typology: Assignments

2009/2010

Uploaded on 03/28/2010

koofers-user-yum
koofers-user-yum 🇺🇸

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download Programming Assignment 1 | Operating Systems | CS 570 and more Assignments Operating Systems in PDF only on Docsity! The goal of this assignment is to understand the concepts and to learn how to create and use dynamic link libraries in 95/98/NT/w2k environment. A good description of the related system services is given in "Win32 System Services” by Marshall Brain (pages 741 through 752 2nd edition, 585-598 3rd edition). The assignment has three parts: PART A - Create a static library A1. Create source files x.cpp and x.h which implement the functions: double add(double a, double b); // Add two doubles double sub(double a, double b); // Subtract two doubles (a-b) and source files y.cpp and y.h which implement the functions: double mul(double a, double b); // Multiply two doubles double divide(double a, double b, int* err); // Divide two doubles (a/b) Operand err is a pointer to an error code which has value 1 in case the second operand has the magnitude less than 0.1e-10, otherwise err is set to 0. Be sure you supply the extern "C" statements in x.h and y.h. A2. Use the files x.cpp and y.cpp to create two static libraries xs.lib and ys.lib. A3. Write the main program (p11.cpp), which prompts the user to enter two doubles, then computes their sum, difference, product and quotient, using the library functions specified above. The output results should be accompanied by proper labels (like: "The sum of a and b is: "). Also, in case of division, the program is checking the error code and is issuing an error message if the division wasn't completed successfully. The program should repeat the prompt-enter- compute cycle as long there are valid data present at the standard input. If anything different than numbers is presented at the input, the program should exit with a proper error message. A4. For compilation, creation of libraries and for linking use commands cl, lib, and link respectively. You may do the job by using a simple (commented!) batch file (p11.bat), or a (commented) make file (p11.mak). Instruction what to turn in is given at the end of this file. PART B - Create a dynamic link library (linked at load time) B1. Use x.obj and y.obj to create libraries x.dll and y.dll. For this you need to supply the definition files x.def and y.def. B2. Using link command create p12.exe which can be dynamically linked with x.dll and y.dll at load time. For this use the same source file p11.cpp from the part A. B3. After you have created all dll and exe files, rename one of the dll files and try to run p12.exe. See what will happen. B4. Return the correct name to the renamed dll file and run p12.exe again. This time you should get successful loading and execution. B5. Change one of the library sources. For example you may change the comments in x.cpp (e.g. add comment: CS570 Operating Systems Spring 2004 Programming Assignment #1 Assigned: January 26 Due: February 4
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved