This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CFA: pseudo-reloc v2


On Sun, Oct 04, 2009 at 01:25:04PM +0200, Corinna Vinschen wrote:
>On Oct  3 13:59, Charles Wilson wrote:
>> #1) Using fprintf and mingw-specific error messages. This is bad, even
>> if they are guarded by DEBUG:
>> 
>> #ifdef DEBUG
>>       fprintf (stderr, "internal mingw runtime error:"
>>                "psuedo_reloc version %d is unknown to this runtime.\n",
>>                (int) v2_hdr->version);
>> #endif
>> 
>> Maybe something like
>> 
>> #if defined(__INSIDE_CYGWIN__)
>>      system_printf (
>>         "Relocation error: invalid pseudo_reloc version %d.",
>>         int) v2_hdr->version);
>> #else
>> #if defined(DEBUG) && defined(__MINGW32__)
>>       fprintf (stderr, "internal mingw runtime error:"
>>                "psuedo_reloc version %d is unknown to this runtime.\n",
>>                (int) v2_hdr->version);
>> #endif
>
>The strace feature under the hood of system_printf is only available
>from within the Cygwin DLL itself.  The pseudo_reloc.c file is not part
>of the DLL, it's linked into the application.  Above all, the strace
>fetaure is only accessible from C++ code.
>
>So, actually fprintf(stderr) is more correct.  However, it's not safe to
>assume that stdio has already been initialized when the runtime
>relocator runs.  AFAICS, the relocator is called before dll_crt0_1 is
>called and only in that latter function, the stdio descriptors are
>initialized.
>
>Failing relocation is as bad as any other error starting an application.
>Wouldn't it be the right thing to raise an exception, along the lines of
>the Windows exception which is raised when a loadtime linked DLL can't
>be loaded?

I'd feel more comfortable with a real error message, even if you have to
use WriteConsole to display it.  Or, a real error message + an
exception.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]