Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-Id: <4.3.1.2.20020408160417.0284fac0@pop.ma.ultranet.com> X-Sender: lhall AT pop DOT ma DOT ultranet DOT com Date: Mon, 08 Apr 2002 16:05:40 -0400 To: fmotta AT embedded-guru DOT com From: "Larry Hall (RFK Partners, Inc)" Subject: Re: Problem with dlopen Cc: In-Reply-To: <30060.65.200.9.2.1018045910.squirrel@portal.embedded-guru. com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" At 06:31 PM 4/5/2002, Frank Motta wrote: >Thanks Larry, > As a result of your response I made a -very- truncated version and got >past the dlopen error. > > The problem seems to be in the -creation- of the dll. > > the instructions at http://cygwin.com/cygwin-ug-net/dll.html result in >many link-time errors and the method I -was- using (see below) does not >export the symbol I need. > > Any ideas? Yes. See below. >from makefile clip 8<----------------------------- ># This creates a dll without the exports I need - see def below >TARGET=simpletest >DLL_SUFF=.dll >LIB_SUFF=.a >DLL_EXP_LIB =$(TARGET)$(DLL_SUFF)$(LIB_SUFF) >DLL_NAME=$(TARGET)$(DLL_SUFF) >INCLUDE= > >simpletest.dll: Makefile simpletest.o > gcc -shared -Wl,--out-implib=$(DLL_EXP_LIB) -o $(DLL_NAME) >$(DLL_OBJS) $ >(DLL_LDFLAGS) $(DLL_LDLIBS) -Wl,--export-all > dlltool --def simpletest.def --dllname simpletest.dll --output-lib ^^^^^^^^^^^^^^ >simpletest.a > >simpletest.o: simpletest.c ../../modules.h ../../global.h ../../types.h > $(CC) $(INCLUDE) -c simpletest.c > >------------------------------------- >8 clip makefile > >from test.def clip 8< ---------------------------------------- ^^^^^^^^ Oops! >EXPORTS >mod_import >------------------------------------ >8 clip test.def > >from simpltest.c 8< --------------------------------------------------- > >void *foo(); >void *(*export_foo)() = foo; >void *mod_import(char **argv) { > return export_foo; >} > >char *hello = "hello world"; >void *foo() { > return (void *) hello; >} >------------------------------------ >8 clip test.c >from nm simpletest.dll | grep T clip 8< ------------------------------ >100010f4 T _DllMain AT 12 >100012a4 T _GetModuleHandleA AT 4 >100012ac T __CTOR_LIST__ >100012b4 T __DTOR_LIST__ >100012ac T ___CTOR_LIST__ >100012b4 T ___DTOR_LIST__ >1000113c T __cygwin_crt0_common AT 8 >10001024 T __cygwin_dll_entry AT 12 >100010d4 T __cygwin_noncygwin_dll_entry AT 12 >10001000 T __end__ >1000125c T _calloc >1000110c T _cygwin_attach_dll >10001104 T _cygwin_detach_dll >1000129c T _cygwin_internal >10001294 T _cygwin_premain0 >1000128c T _cygwin_premain1 >10001284 T _cygwin_premain2 >1000127c T _cygwin_premain3 >10001254 T _dll_dllcrt0 >10001000 T _end >1000126c T _free >10001274 T _malloc >10001264 T _realloc >10001000 T end >100012bc T etext >--------------------------------------------- >8 nm output > >Notice the -lack- of mod_import!!! > > > > >Thanks !!!! > > > > > > At 02:51 PM 4/5/2002, Frank Motta wrote: > >>The following code returns Win32 error 126 - this is the same error I get >if I try a file which does not exist. > >> > >>What is going wrong (operator malfunction - I'm sure!) > >>please help > >> strncat(mod_file_name, LIB_EXT, LIB_EXT_LEN + 1); > >> // FJM handle = dlopen(mod_file_name, (RTLD_NOW | > >> RTLD_GLOBAL)); handle = dlopen(mod_file_name, > >> (DLOPEN_MODE)); > >> if ((err = dlerror()) == NULL) { break; } > > > > > > $ net helpmsg 126 > > The specified module could not be found. > > > > With the information you've given, one can only say mod_file_name is not >where you say it is. If that's the issue, it's not a Cygwin problem and >would be off-topic for this list. If that's not the problem, you'll need >to provide more information about the specifics. Results from debugging >into Cygwin or even output from running your program under strace would be >useful to further any pertinent > > discussion. > > > > > > > > Larry Hall lhall AT rfk DOT com > > RFK Partners, Inc. http://www.rfk.com > > 838 Washington Street (508) 893-9779 - RFK Office >Holliston, MA 01746 (508) 893-9889 - FAX > > >-- >Frank Motta >fmotta AT embedded-guru DOT com > >If you cannot recognize divinity in your fellow man, then you will not >realize the devine within yourself... > -- 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/