This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: [patch bfd]: Fix PR ld/12742 for windows targets


On Sat, Mar 10, 2012 at 3:58 AM, Jeffrey Walton <noloader@gmail.com> wrote:
> On Fri, Mar 9, 2012 at 2:54 PM, Kai Tietz <ktietz70@googlemail.com> wrote:
>> Hi,
>>
>> this patch adds compatible implementation of dlfcn API on Windows
>> targets, if this header/API isn't present.
>>
>> ChangeLog
>>
>> 2012-03-09 ÂKai Tietz Â<ktietz@redhat.com>
>>
>> Â Â Â ÂPR ld/12742
>> Â Â Â Â* configure.in (AC_CHECK_HEADERS): Test for windows.h and dlfcn.h.
>> Â Â Â Â* plugin.c: Guard include of dlfcn.h if HAVE_DLFCN_H is defined.
>> Â Â Â ÂAdd windows.h header include if HAVE_WINDOWS_H is defined.
>> Â Â Â Â(dlerror): New static function if windows variant is used instead
>> Â Â Â Âof dlfcn.h.
>> Â Â Â Â(dlclose): Likewise.
>> Â Â Â Â(dlopen): Likewise.
>> Â Â Â Â(dlsym): Likewise.
>> Â Â Â Â* configure: Regenerated.
>> Â Â Â Â* config.in: Regenerated.
>>
>> Tested for i686-w64-mingw32 and x86_64-w64-mingw32. ÂOk for apply?
>>
>> Regards,
>> Kai
>>
>> [SNIP]
>
> If filename is NULL, I believe LoadLibrary will treat the filename as
> an ordinal. Perhaps you should explicitly test the char* against NULL
> (unless, of course, you want to return the function at ordinal 0):
>
>> +dlopen (const char *file, int mode ATTRIBUTE_UNUSED)
>> +{
>> + Âreturn LoadLibrary (file);
>> +}
>
> I think you wil get expected behavior if there are no ordinals, which
> means you might have an intermittent problem.
My bad - I meant function name:

+static void *
+dlsym (void *handle, const char *name)
+{
+  return GetProcAddress (handle, name);
+}


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