www.delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Message-ID: | <3C61E3C1.9010200@watsen.net> |
Date: | Wed, 06 Feb 2002 18:17:37 -0800 |
From: | Kent Watsen <kent AT watsen DOT net> |
User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.8) Gecko/20020204 |
X-Accept-Language: | en-us |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | dlopen(0, RTLD_LAZY) doesn't work? |
Hi, I've read the mailing list archives and searched google trying to figure out how to get the following program to work. All you have to do is save it to a file (foo.c), compile (gcc foo.c), and run - I always get "dlsym() failed." Note, I have tried many variations of extern and _declspec as well as looking for "_foo" in addition to "foo" ("nm a.exe | grep foo" returned "0040104c T _foo"... Here is the code - help would be greatly appreciated - thanks! #include <stdio.h> #include <dlfcn.h> #include <windows.h> extern __declspec(dllexport) void foo(void) { printf("hello\n"); } int main(int argc, char *argv[]) { void* dl = NULL; void* func = NULL; dl = dlopen(0 , RTLD_LAZY); if (dl == NULL) { printf("dlopen() failed\n"); exit(0); } func = dlsym(dl, "foo"); if (func == NULL) { printf("dlsym() failed\n"); exit(0); } printf("do something meaningful\n"); dlclose(dl); return 0; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |