Multiple file compilation and linking
This presentation is the property of its rightful owner.
Sponsored Links
1 / 1

Multiple File Compilation and Linking PowerPoint PPT Presentation


  • 71 Views
  • Uploaded on
  • Presentation posted in: General

Multiple File Compilation and Linking . pthread.h. stdio.h. mars.h. venus.h. #ifndef STDIO_H #define STDIO_H #endif. #ifndef PTHREAD_H #define PTHREAD_H #endif. #ifndef MARS_HEADER #define MARS_HEADER #define MIN 1000 int doA(int nbr); #endif. #ifndef VENUS_HEADER

Download Presentation

Multiple File Compilation and Linking

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Multiple file compilation and linking

Multiple File Compilation and Linking

pthread.h

stdio.h

mars.h

venus.h

#ifndef STDIO_H

#define STDIO_H

#endif

#ifndef PTHREAD_H

#define PTHREAD_H

#endif

#ifndef MARS_HEADER

#define MARS_HEADER

#define MIN 1000

int doA(int nbr);

#endif

#ifndef VENUS_HEADER

#define VENUS_HEADER

typedef struct

{ // fields

} gravityType;

void doB(char symbol);

#endif

programX.c

#include <stdio.h>

#include <pthread.h>

#include “mars.h”

#include “venus.h”

main()‏

{

gravityType value;

pthread_t threadID;

int result;

printf(“Hello”);

result = doA(5);

doB(‘d’);

} // End main

mars.c

venus.c

#include <stdio.h>

#include “mars.h”

int doA(int nbr)‏

{

return nbr * nbr;

} // End doA

#include “venus.h”

#include <pthread.h>

#define MAX 100

void doB(char symbol)‏

{

pthread_t threads[MAX];

} // End doB

programX.o

libc.a

libpthread.a

mars.o

venus.o

Object code

file

The Standard

C Library

Threads

library

Object code

file

Object code

file

a.out

gcc programX.c mars.c venus.c

Executable File


  • Login