old-www/HOWTO/C++-dlopen/faq.html

270 lines
4.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML
><HEAD
><TITLE
>Frequently Asked Questions</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="C++ dlopen mini HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Source Code"
HREF="source.html"><LINK
REL="NEXT"
TITLE="See Also"
HREF="seealso.html"></HEAD
><BODY
CLASS="section"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>C++ dlopen mini HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="source.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="seealso.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="faq"
></A
>5. Frequently Asked Questions</H1
><DIV
CLASS="qandaset"
><DL
><DT
>5.1. <A
HREF="faq.html#AEN253"
>I'm using Windows and I can't find the
<TT
CLASS="filename"
>dlfcn.h</TT
> header file! What's the problem?</A
></DT
><DT
>5.2. <A
HREF="faq.html#AEN263"
>Is there some kind of <TT
CLASS="function"
>dlopen</TT
>-compatible
wrapper for the Windows <TT
CLASS="function"
>LoadLibrary</TT
>
API?</A
></DT
></DL
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN253"
></A
><B
>5.1. </B
>I'm using Windows and I can't find the
<TT
CLASS="filename"
>dlfcn.h</TT
> header file! What's the problem?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>The problem is that Windows doesn't have the
<TT
CLASS="function"
>dlopen</TT
> API, and thus there is no
<TT
CLASS="filename"
>dlfcn.h</TT
> header. There is a similar API
around the <TT
CLASS="function"
>LoadLibrary</TT
> function, and
most of what is written here applies to it, too. Please refer to the
<A
HREF="http://msdn.microsoft.com/"
TARGET="_top"
>Microsoft Developer Network
Website</A
> for more information.</P
></DIV
></DIV
><DIV
CLASS="qandaentry"
><DIV
CLASS="question"
><P
><A
NAME="AEN263"
></A
><B
>5.2. </B
>Is there some kind of <TT
CLASS="function"
>dlopen</TT
>-compatible
wrapper for the Windows <TT
CLASS="function"
>LoadLibrary</TT
>
API?</P
></DIV
><DIV
CLASS="answer"
><P
><B
> </B
>I don't know of any, and I don't think there'll ever be one
supporting all of <TT
CLASS="function"
>dlopen</TT
>'s options.</P
><P
>There are alternatives though: libtltdl (a part of libtool),
which wraps a variety of different dynamic loading APIs, among
others <TT
CLASS="function"
>dlopen</TT
> and
<TT
CLASS="function"
>LoadLibrary</TT
>. Another one is the <A
HREF="http://developer.gnome.org/doc/API/glib/glib-dynamic-loading-of-modules.html"
TARGET="_top"
>Dynamic
Module Loading functionality of GLib</A
>. You can use one
of these to ensure better possible cross-platform compatibility.
I've never used any of them, so I can't tell you how stable they
are and whether they really work.</P
><P
>You should also read section 4, <SPAN
CLASS="QUOTE"
>"Dynamically
Loaded (DL) Libraries"</SPAN
>, of the <A
HREF="http://www.dwheeler.com/program-library"
TARGET="_top"
>Program Library
HOWTO</A
> for more techniques to load libraries and
create classes independently of your platform.</P
></DIV
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="source.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="seealso.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Source Code</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>See Also</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>