From:	CRDGW2::CRDGW2::MRGATE::"SMTP::PREP.AI.MIT.EDU::HELP-GCC-REQUEST" 22-FEB-1992 09:24:05.58
To:	ARISIA::EVERHART
CC:	
Subj:	Re: On SunOS4, how to avoid _dlclose, etc?

From:	help-gcc-request@prep.ai.mit.edu@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.123)
	 id AA27487; Sat, 22 Feb 92 08:40:25 EST
Received: by life.ai.mit.edu (4.1/AI-4.10) id AA28145; Sat, 22 Feb 92 00:19:19 EST
Return-Path: <help-gcc-request@prep.ai.mit.edu>
Received: from news.cis.ohio-state.edu by life.ai.mit.edu (4.1/AI-4.10) id AA28139; Sat, 22 Feb 92 00:18:58 EST
Received: by news.cis.ohio-state.edu (5.61-kk/5.911008)
	id AA09198; Sat, 22 Feb 92 00:16:02 -0500
Received: from USENET by news.cis.ohio-state.edu with netnews
	for help-gcc@prep.ai.mit.edu (help-gcc@prep.ai.mit.edu);
	contact usenet@news.cis.ohio-state.edu if you have questions.
To: help-gcc@prep.ai.mit.edu
Date: 22 Feb 92 05:13:24 GMT
Message-Id: <ZOO.92Feb21231324@lynx.spa.umn.edu>
Organization: Hackers 'R' Us
From: zoo@aps1.spa.umn.edu (david d 'zoo' zuhn)
Sender: help-gcc-request@prep.ai.mit.edu
References: <DXZ.92Feb21162429@bishop.ics.hawaii.edu>edu
Subject: Re: On SunOS4, how to avoid _dlclose, etc?

>> I am trying to compile a program using gcc.  The -static option
>> seems not be working for me.  I get the message "Undefined symbol:
>> _dlclose, _dlopen, _dlsym".  These symbols are used in libc.a.

>> Anybody knows how I can avoid this problem? Thanks in advance.

This is a bug in SunOS.  There is a standard fix in the MIT X11R5
source tree as mit/util/misc/dlsym.c, which I appended to this
message.  Just compile and link against this file and all will be well
(at least this bug will be fixed, no comment on any other bugs you
might have).

david d [zoo] zuhn		Univ. of Minnesota Dept. of Astronomy
zoo@aps1.spa.umn.edu		      Automated Plate Scanner Project
 -- member of the League for Programming Freedom -- email me for info


------ slice 'n dice ----------
/*
 * Stub interface to dynamic linker routines
 * that SunOS uses but didn't ship with 4.1.
 *
 * The C library routine wcstombs in SunOS 4.1 tries to dynamically
 * load some routines using the dlsym interface, described in dlsym(3x).
 * Unfortunately SunOS 4.1 does not include the necessary library, libdl.
 *
 * The R5 Xlib uses wcstombs.  If you link dynamcally, your program can
 * run even with the unresolved reference to dlsym.  However, if you
 * link statically, you will encounter this bug.  One workaround
 * is to include these stub routines when you link.
 */

void *dlopen()
{
    return 0;
}

void *dlsym()
{
    return 0;
}

int dlclose()
{
    return -1;
}
