Re: how to detect extension of shared library in cpp file

Scott Bailey <[email protected]> Wed, 28 Oct 2009 14:30:48 -0700
Newsgroups gmane.comp.sysutils.bakefile.devel
Message-ID <[email protected]>
--===============1481164783597936466==
Content-Type: multipart/alternative; boundary=0015175770ea19beac0477058215

--0015175770ea19beac0477058215
Content-Type: text/plain; charset=ISO-8859-1

I search for shared libs using defines.

#if defined(NDEBUG)
#  if defined(_WIN32)
const std::string PLUG_NAME("\\*plug.dll");
#  elif defined(__APPLE__)
const std::string PLUG_NAME("/*plug.dylib");
#  else
const std::string PLUG_NAME("/*plug.so");
#  endif
#else

#  if defined(_WIN32)
const std::string PLUG_NAME("\\*plugd.dll");
#  elif defined(__APPLE__)
const std::string PLUG_NAME("/*plugd.dylib");
#  else
const std::string PLUG_NAME("/*plugd.so");
#  endif
#endif

On Wed, Oct 28, 2009 at 1:54 PM, Lukasz Michalski <[email protected]> wrote:

> Hi,
>
> Bakefile creates .dll files on MSW, .so files on Unix and .bundle files
> on Mac.
>
>
>
> I use autoconf and have code like this:
>
> void
> DbPlugin::load(const char* pFilename) {
>  std::string name;
>  name.append(pFilename);
> #ifdef _MSC_VER
>  name.append(".dll");
>  mLibHandle = ::LoadLibrary(TEXT(name));
> #elif defined(HAVE_DLOPEN)
>  name.append(".so");
>  mLibHandle = dlopen(name.c_str(), RTLD_LAZY);
> #endif
> };
>
> My problem is that both Mac and Linux uses dlopen but bakefile creates
> files with different extensions. Does anyone know what is the best way
> to detect in .cpp file what extension should be appended to filename?
>
> Any hints greatly appreciated,
>
> Regards,
> --
> Lukasz Michalski
> pgp key: http://www.zork.pl/lm.asc
>
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Bakefile-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/bakefile-devel
>
>


-- 
Scott Bailey

--0015175770ea19beac0477058215
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I search for shared libs using defines.<br><br>#if defined(NDEBUG)<br>#=A0 =
if defined(_WIN32)<br>const std::string PLUG_NAME(&quot;\\*plug.dll&quot;);=
<br>#=A0 elif defined(__APPLE__)<br>const std::string PLUG_NAME(&quot;/*plu=
g.dylib&quot;);<br>
#=A0 else<br>const std::string PLUG_NAME(&quot;/*plug.so&quot;);<br>#=A0 en=
dif<br>#else=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0 <br>#=A0 if defined(_WIN32)<br>const std::string PLUG=
_NAME(&quot;\\*plugd.dll&quot;);<br>
#=A0 elif defined(__APPLE__)<br>const std::string PLUG_NAME(&quot;/*plugd.d=
ylib&quot;);<br>#=A0 else<br>const std::string PLUG_NAME(&quot;/*plugd.so&q=
uot;);<br>#=A0 endif<br>#endif<br><br><div class=3D"gmail_quote">On Wed, Oc=
t 28, 2009 at 1:54 PM, Lukasz Michalski <span dir=3D"ltr">&lt;<a href=3D"ma=
ilto:[email protected]">[email protected]</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, =
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
<br>
Bakefile creates .dll files on MSW, .so files on Unix and .bundle files<br>
on Mac.<br>
<br>
<br>
<br>
I use autoconf and have code like this:<br>
<br>
void<br>
DbPlugin::load(const char* pFilename) {<br>
 =A0std::string name;<br>
 =A0name.append(pFilename);<br>
#ifdef _MSC_VER<br>
 =A0name.append(&quot;.dll&quot;);<br>
 =A0mLibHandle =3D ::LoadLibrary(TEXT(name));<br>
#elif defined(HAVE_DLOPEN)<br>
 =A0name.append(&quot;.so&quot;);<br>
 =A0mLibHandle =3D dlopen(name.c_str(), RTLD_LAZY);<br>
#endif<br>
};<br>
<br>
My problem is that both Mac and Linux uses dlopen but bakefile creates<br>
files with different extensions. Does anyone know what is the best way<br>
to detect in .cpp file what extension should be appended to filename?<br>
<br>
Any hints greatly appreciated,<br>
<br>
Regards,<br>
<font color=3D"#888888">--<br>
Lukasz Michalski<br>
pgp key: <a href=3D"http://www.zork.pl/lm.asc" target=3D"_blank">http://www=
.zork.pl/lm.asc</a><br>
<br>
</font><br>----------------------------------------------------------------=
--------------<br>
Come build with us! The BlackBerry(R) Developer Conference in SF, CA<br>
is the only developer event you need to attend this year. Jumpstart your<br=
>
developing skills, take BlackBerry mobile applications to market and stay<b=
r>
ahead of the curve. Join us from November 9 - 12, 2009. Register now!<br>
<a href=3D"http://p.sf.net/sfu/devconference" target=3D"_blank">http://p.sf=
.net/sfu/devconference</a><br>_____________________________________________=
__<br>
Bakefile-devel mailing list<br>
<a href=3D"mailto:[email protected]">Bakefile-devel@list=
s.sourceforge.net</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/bakefile-devel" tar=
get=3D"_blank">https://lists.sourceforge.net/lists/listinfo/bakefile-devel<=
/a><br>
<br></blockquote></div><br><br clear=3D"all"><br>-- <br>Scott Bailey<br>

--0015175770ea19beac0477058215--


--===============1481164783597936466==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
--===============1481164783597936466==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Bakefile-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bakefile-devel

--===============1481164783597936466==--