delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/05/31/06:33:20

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Date: Wed, 31 May 2000 11:32:36 +0100 (BST)
Message-Id: <200005311032.LAA70512@ceratops>
From: Jon Cook <cookj AT cs DOT man DOT ac DOT uk>
To: cygwin AT sourceware DOT cygnus DOT com
Subject: 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 AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019