-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8120862
commit 489e445
Showing
10 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
gcc -fPIC -c *.c | ||
gcc -shared *.o -o liball.so | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <stdio.h> | ||
|
||
int add(int a, int b) { | ||
return a + b; | ||
} | ||
|
||
int sub(int a, int b) { | ||
return a - b; | ||
} | ||
|
||
int mul(int a, int b) { | ||
return a * b; | ||
} | ||
|
||
int div(int a, int b) { | ||
if (b == 0) { | ||
printf("Error: Division by zero\n"); | ||
return 0; | ||
} | ||
return a / b; | ||
} | ||
|
||
int mod(int a, int b) { | ||
if (b == 0) { | ||
printf("Error: Division by zero\n"); | ||
return 0; | ||
} | ||
return a % b; | ||
} | ||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
wget -P /tmp https://github.com/mahmoudkhalef/alx-low_level_programming/raw/master/0x18-dynamic_libraries/libgiga.so | ||
export LD_PRELOAD=/tmp/libgiga.so | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dynamiclib |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef MAIN_H | ||
#define MAIN_H | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
int _putchar(char c); | ||
int _islower(int c); | ||
int _isalpha(int c); | ||
int _abs(int n); | ||
int _isupper(int c); | ||
int _isdigit(int c); | ||
int _strlen(char *s); | ||
void _puts(char *s); | ||
char *_strcpy(char *dest, char *src); | ||
int _atoi(char *s); | ||
char *_strcat(char *dest, char *src); | ||
char *_strncat(char *dest, char *src, int n); | ||
char *_strncpy(char *dest, char *src, int n); | ||
int _strcmp(char *s1, char *s2); | ||
char *_memset(char *s, char b, unsigned int n); | ||
char *_memcpy(char *dest, char *src, unsigned int n); | ||
char *_strchr(char *s, char c); | ||
unsigned int _strspn(char *s, char *accept); | ||
char *_strpbrk(char *s, char *accept); | ||
char *_strstr(char *haystack, char *needle); | ||
|
||
#endif /* MAIN_H */ | ||
|