fread64 fwrite64 compilation problem (undefined symbol)


 
Thread Tools Search this Thread
Top Forums Programming fread64 fwrite64 compilation problem (undefined symbol)
# 1  
Old 07-28-2005
Data fread64 fwrite64 compilation problem (undefined symbol)

I use a standard C source to access large files in a 32 bit environment.
I've replaced fopen, fwrite and fread by fopen64, fwrite64 and fread64.
First I did a test only replacing fopen by fopen64, it compiled without any other changes to my compilation options.
The program crashed on a write, as I expected. then I replaced fwrite and fread by fwrite64 & fread64. But then I cannot compile it!!
Here's the error :
cc -c mergesor.c
cc -I/include -c smergeso.c
cc -o sort_msr13 sort.c llmsort.o mergesor.o smergeso.o
ld: 0711-317 ERROR: Undefined symbol: .fwrite64
ld: 0711-317 ERROR: Undefined symbol: .fread64

I tried with these macros :

#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
#include <stdio.h>
etc...

But without success

Can you help?
What should I add to allow fread64 and fwrite64?
# 2  
Old 07-28-2005
I think the functions fwrite64 and fread64 do not exist.

So i think you should be able to use fread to read from a file, opened with fopen64. but i have not tried it.

----

man fopen:
fopen, fopen64, freopen, freopen64 or fdopen Subroutine

man fread:
fread or fwrite Subroutine

man ftell
fseek, fseeko, fseeko64, rewind, ftell, ftello, ftello64, fgetpos, fgetpos64,
fsetpos, or fsetpos64 Subroutine
# 3  
Old 08-01-2005
It's not obvious to me which OS you're trying to use "large" files with.

There are defines to use to enable 64 bit file sizes. What most of them do is to create different declarations for standard functions like fopen.... those new entry points usually have mangled names like __fopen64().

Secondly, on some OSes, the kernel has to be configured to use large files.

In some cases large file support is built in to the libc library and the kernel by default.
# 4  
Old 08-16-2005
It depends on which UNIX you're using. Standards are spotty in this area, or at least too new to be well-established.

On some, like 32-bit linux, there's no fundamental difference between large and small files; they're just....bigger. The same reading, writing, opening, and closing functions can be used for them -- the only problem they give the programmer is how to seek to a farther point than you can specify with a 32-bit integer. To get around this the linux kernel has one special 64-bit seek function, _llseek. It's a better idea to use a real API of some sort than a raw system call though.

32-bit Solaris, on the other hand, will apparently puke with an overflow error if you so much as open a large file without their large-file open! To get around this they provided <insert function name here>64 functions for nearly everything.

Looking in my linux system's stdio.h, I see fseeko64 and ftello64 functions. If your system has these or something like them, they might be all you need.

If you don't have these under stdio, you may need to use the underlying system functions.

Last edited by Corona688; 08-16-2005 at 04:34 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Undefined Symbol

When I try to link a .so file I get the undefined symbol error. Though I have the library file in my system. The compile and linking commands used are as follows g++ -m64 -g -Wall -I./include -c dxl_sample.c g++ -o firstprogram -m64 -g -Wall -I./include -Bdynamic... (1 Reply)
Discussion started by: Ranadeep Ghosal
1 Replies

2. Programming

Undefined Symbol

When I try to link a .so file I get the undefined symbol error. Though I have the library file in my system. The compile and linking commands used are as follows g++ -m64 -g -Wall -I./include -c dxl_sample.c g++ -o firstprogram -m64 -g -Wall -I./include -Bdynamic... (1 Reply)
Discussion started by: Ranadeep Ghosal
1 Replies

3. Programming

gmake undefined symbol error

I have a C code which i am trying to compile using gcc. When i am trying to compile it i get the error undefined symbol error though i am providing the -l*** option where *** refers to the module where the object files for those symbols are present. Can someone help me on the same. (4 Replies)
Discussion started by: manaankit
4 Replies

4. Programming

ld: 0711-317 ERROR: Undefined symbol: stdscr

I am trying to compile pro*c program on aix 5.3. The program compiled fine when I was using curses library. After switching to ncurses, I have started getting compilation errors. After installing ncurses on the box, I changed the -lcurses flag to -lncurses. I have also updated the path to the... (13 Replies)
Discussion started by: wvuguy
13 Replies

5. Programming

Error: Undefined Symbol ..... First referenced in file......

Hi, I am working with Solaris 5.9 and I am newbie in Socket programming and I stated working with socket programming and I copyed a simple client & server program from a website which I am attaching with this and when I am compiling these files.I am getting the error-- Please Help me to... (1 Reply)
Discussion started by: smartgupta
1 Replies

6. AIX

Undefined symbol: .log

Hi All, When I am compiling expect 5.40 library in AIX 5.3, I am getting the following error while generating expect5.40.so file. ld: 0711-317 ERROR: Undefined symbol: .log ld: 0711-317 ERROR: Undefined symbol: .pow ld: 0711-345 Use the -bloadmap or... (0 Replies)
Discussion started by: ravindra_maddal
0 Replies

7. Programming

undefined symbol: clock_gettime' error

Hi, i've compiled my app on x86_64 with -m32 gcc option. Can anybody tell me what is/would typically cause the 'undefined symbol: clock_gettime' error?? -1 k){0N!x y} '/home/da71336/simon/mkvfh/mkv.so: undefined symbol: clock_gettime @ "q" "subr:mkv 2:`subr,3; subc:mkv 2:`subc,1;... (4 Replies)
Discussion started by: dpa078
4 Replies

8. Programming

shared object "undefined symbol: fstat" error

Didn't have this problem in AIX, but ported to Linux with GCC compiler and am now getting a runtime error: tssutil: symbol lookup error: /work/agility/devel/bin/libagam.so: undefined symbol: fstat I'm sure most of you know that fstat is an intrinsic function just like printf, memcpy, etc. When I... (5 Replies)
Discussion started by: marcus121
5 Replies

9. Programming

Undefined symbol: .getcury in getyx

Iam attempting a script to return the current cursor position using the getyc macro I have #included the curses.h however on compilation (with gcc) it errors with Undefined symbol .getcury Undefined symbol .gercurx Any ideas where I can find a solution or what I've missed (7 Replies)
Discussion started by: gefa
7 Replies

10. Programming

ld: 0711-317 ERROR: Undefined symbol: .hello

Hello, when i compile with xlc on aix i got the error message "ld: 0711-317 ERROR: Undefined symbol: .hello" dummy.pc: #include <stdio.h> #include <stdlib.h> #include <string.h> #include "dummy.h" int main ( ) { printf("\nbefore Hello"); hello(); printf("\npast Hello"); ... (2 Replies)
Discussion started by: stockdan
2 Replies
Login or Register to Ask a Question