This is the mail archive of the cygwin@sourceware.cygnus.com 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]

dlopen a.exe



Hi,

Can you use dlopen with the pathname set to 0 to open a.exe?
When I tried doing this with the code below, dlsym failed with "Win32
Error 127".

Thanks for any help,
Jon



#include <dlfcn.h>

float fn(float num)
{
  return num*5.0;
}

int main(void)
{
  void *hnd, *fnaddr;

  hnd= dlopen(0, RTLD_NOW);

  if (!hnd) {
    printf("Failed at dlopen - %s\n", dlerror());
    exit(1);
  }

  fnaddr= dlsym(hnd, "fn");

  if (!fnaddr) {
    printf("Failed at dlsym - %s\n", dlerror());
    exit(1);
  }
  
  printf("OK [%x]\n", fnaddr);
}

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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