Bug 5434
Summary: | Problem with FILEs and/or shared libraries | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | armand.bendanan |
Component: | libc | Assignee: | Cristian Gafton <gafton> |
Status: | CLOSED WORKSFORME | QA Contact: | |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | 6.0 | ||
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 1999-10-05 06:34:48 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
armand.bendanan
1999-09-29 12:05:08 UTC
I am sorry, it is not a mandrake version, but a red hat 6.0 version. As I don't know how to send you my files, here they are : ------------------------- file : makefile: CPPFLAGS = -g CC = gcc LIBRARY = libalib.so PROGRAM = main OBJECTS = inlib.o main.o TARGETS = $(OBJECTS) $(LIBRARY) $(PROGRAM) all : $(TARGETS) clean : rm core $(TARGETS) 2> /dev/null $(PROGRAM) : main.o $(LIBRARY) $(CC) -o $@ main.o $(LIBRARY) $(LIBRARY) : inlib.o ld -o $@ -G inlib.o inlib.o : inlib.c main.o : main.c inlib.h ------------------------- file : inlib.h #ifndef _IN_LIB_H_ #define _IN_LIB_H_ extern int read_file (char *file); #endif ------------------------- file : inlib.c: #include <stdio.h> #include "inlib.h" extern int read_file (char *file_name) { FILE *fd = fopen(file_name, "r"); if (fd == NULL) { printf("error opening file:%s\n", file_name); return 1; } fclose (fd); return 0; } ------------------------- file : main.c: #include <stdio.h> #include "inlib.h" FILE *msgf = NULL; int main (int argc, char **argv) { char *file_name = "file.txt"; /****************************************************** * if I uncomment the following lines, the program works ??? !!! ******************************************************/ /************ FILE *fd = fopen(file_name, "r"); if (fd == NULL) { printf("error opening file:%s\n", file_name); return 1; } fclose (fd); **************/ if (read_file (file_name) != 0) { printf ("Exit\n"); exit (1); } /****************************************************** * if I comment the following 3 lines, the program works ??? !!! ******************************************************/ if (msgf == NULL) { msgf = fopen ("/dev/null", "w"); } printf ("################### WON ==============\n"); fflush (stdout); return 0; } Works for me, provided that you are actually using -fPIC compiler option and -shared linker option to generate correctly the shared library. I don't know about Mandrake - one thing I know for sure is that their optimized compiler is screwing up big time glibc on their system (and not only that, but we won't get into that) |