This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/2] Add symbol-handling callbacks to the jit-reader interface.
> Sanjoy> +#include <dlfcn.h>
>
> I assume this isn't portable.
>
> You could either lift the needed code from GCC's plugin interface, or I
> suppose use libtool's libltdl.
There was a similar need for the VxWorks port, that I have yet
to rebase, retest, and commit :-(. In any case, I thought it would
be very easy to create gdb_dlfcn.h/c:
| #ifdef HAVE_LIBDL
| #include <dlfcn.h>
| #elif __MINGW32__
| #include <windows.h>
| #else
| /* Unsupported configuration. See Eg. gdb_dlopen for details. */
| #error API to load shared library missing (Eg. libdl)
| #endif
|
| /* Load the dynamic library file named FILENAME, and return a handle
| for that dynamic library. Return NULL if the loading fails for
| any reason. */
|
| static void *
| gdb_dlopen (const char *filename)
| {
| #ifdef HAVE_LIBDL
| return dlopen (filename, RTLD_NOW);
| #elif __MINGW32__
| return (void *) LoadLibrary (filename);
| #endif
| }
|
| /* Return the address of the symbol named SYMBOL inside the shared library
| whose handle is HANDLE. Return NULL when the symbol could not be found. */
|
| static void *
| gdb_dlsym(void *handle, const char *symbol)
| {
| #ifdef HAVE_LIBDL
| return dlsym (handle, symbol);
| #elif __MINGW32__
| return (void *) GetProcAddress (handle, symbol);
| #endif
| }
--
Joel