Sunteți pe pagina 1din 2

1. Create a static library in Linux. --> Consider you are having 3 files main.c file1.c file2.

c Below are the steps for creation of static library -- gcc -Wall -c file1.c file2.c -- ar -cvq libcstat.a file1.o file2.o -- ar -t libcstat.a Step for linking static library created while compiling -- gcc -o main main.c libcstat.a or -- gcc -o main main.c -L/<path-to-static-library-directory> -lcstat 2. Create a Dynamic library in Linux. --> Consider you are having 3 files main.c file1.c file2.c Below are the steps for creation of static library -- gcc -Wall -fPIC -c *.c -- gcc -shared -Wl,-soname,libcdynm.so.1 -o libcdynm.so.1.0

*.o

Step for linking dynamic library -- gcc -Wall -L/<path-to-dynamic-library-directory> main.c -lcdynm -o m ain 3. Difference between static library and dynamic library. Static libraries are linked at compile time so they are contained in whatever ex ecutable (.exe) that uses them. Dynamic libraries are linked at run-time and are contained in their own file (.dll) Static libraries are loaded when the program is compiled and dynamically-linked libraries are loaded in while the program is running. Dynamic libraries save the RAM space as against the static library because linking to static libraries inc ludes the actual code for the library function(s)/procedure(s) with the executab le. DLL code is kept at one location and is usually shared among all the process es that use the DLL. 4. Create a Makefile to compile a set of source files. CC=gcc IDIR=include CFLAGS=-I/$(IDIR) SDIR=src ODIR=obj EXE=exe #_DEPS = header.h #DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS)) _OBJ = main.o str_concat.o str_copy.o OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) $(ODIR)/%.o: $(SDIR)/%.c $(CC) -c -o $@ $< $(CFLAGS) $(EXE)/main:$(OBJ) $(CC) -o $@ $^ $(CFLAGS) .PHONY: clean clean: rm -f $(ODIR)/*.o $(EXE)/*

5. Difference between soft and hard links --> Hard links point to the file content while Soft link points to the file name . while size of hard link is the size of the content while soft link is having the file name size A hard link then just creates another file with a link to the same underlying in ode. A symbolic link(soft link) is a link to another name in the file system. 6. Difference between cron and anacron. --> CRON :: Cron allows users to schedule tasks for very specific times. All app lications of cron can schedule tasks to the minute, and some implementations eve n allow users to pinpoint the precise second at which the system should begin th e action. Tasks can run on specific dates, or recur at periods as small as every minute. Cron also allows users in large, national systems to designate the time zone under which their tasks fall, to ensure proper execution using local times . ANACRON :: If you schedule a task for a specific date and the system is down on that date, the task will never execute Anacron allows you to schedule tasks that will run on either a specified date or the first available cycle after that date. Anacron allows daily scheduling. 7. Default Port numbers used by ssh,ftp,http,https,telnet,smtp,pop3,pop3s,imap,i maps ssh-secure shell 22 ftp-file transfer protocol 21 http-hyper text transfer protocol 80 https 443 telnet 992 smtp-simple mail transfer protocol 25 pop3-post office protocol 3 110 pop3s-pop3 with ssl 995 imap-internet message access protocol 143 imaps 993

S-ar putea să vă placă și