freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] [Doubt] Error with STREAM_FILE function.


From: Parth Wazurkar
Subject: Re: [ft-devel] [Doubt] Error with STREAM_FILE function.
Date: Wed, 13 Jun 2018 10:32:18 +0530

>`STREAM_FILE' is a macro!  In other words, it must *never* appear as
>an undefined symbol in the DLL.  Doing `git grep STREAM_FILE', I get
>  ...
>  builds/unix/ftsystem.c:  /* We use the macro STREAM_FILE for convenience to extract the       */
>  builds/unix/ftsystem.c:#define STREAM_FILE( stream )  ( (FILE*)stream->descriptor.pointer )
>  ...
>  src/base/ftsystem.c:  /* We use the macro STREAM_FILE for convenience to extract the       */
>  src/base/ftsystem.c:#define STREAM_FILE( stream )  ( (FT_FILE*)stream->descriptor.pointer )
>  src/base/ftsystem.c:    ft_fclose( STREAM_FILE( stream ) );
>  src/base/ftsystem.c:    file = STREAM_FILE( stream );

>As can be seen, `STREAM_FILE' is only locally defined in
>`builds/unix/ftsystem.c' and `src/base/ftsystem.c'.  If you want to
>have such an abbreviation in a different source file, you have to
>#define it.

>What are you trying to do?

Actually I want to extract the file pointer from the input stream.
For this I initially used (FILE*)stream->descriptor.pointer to get the pointer but it
did not allocate the pointer and gave a segmentation fault with fseek.
Later I figured about this macro STREAM_FILE to do the work but it showed
undefined symbol in the o/p.
Now I thought that there might be a problem with the (FILE*)stream->descriptor.pointer
i.e. it might not be allocated the pointer in the first place.
I then did an explicit fopen on the filename later and my code ran properly.
Now the problem is that I cannot extract file pointer from the stream.
Also, if STREAM_FILE is already defined to be used to ease the process,
then why is it showing undefined symbol?

Thank you

--
Parth

reply via email to

[Prev in Thread] Current Thread [Next in Thread]