[Insight-users] How to extend ITK with DLLs at runtime?
Parag Chandra
pchandra at radonc . unc . edu
Wed, 14 May 2003 16:02:35 -0400
This is a multi-part message in MIME format.
------=_NextPart_000_0018_01C31A32.3C1EBC00
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi,
=20
I am trying to use the DynamicLoader and ObjectFactory mechanism to =
create
subclasses which can be packaged into shared libraries and then loaded
dynamically at runtime. I know that the ImageIO framework was designed =
to
allow this sort of behavior, but I don't understand all the details of =
how
to make it work. Looking at ImageIOFactory, it's clear that
ObjectFactoryBase::CreateAllInstance is called in order to create all =
the
registered subclasses of a particular base class. Each of these =
subclasses
is then queried to determine which, if any, is the correct one to handle =
a
particular image format. However, all of these subclasses are =
essentially
linked in statically at compile time, and their corresponding factories =
are
explicitly registered via ImageIOFactory::RegisterBuiltInFactories. If I
wrote a new ImageIO class and packaged it as a shared library, how would =
I
get it to automatically register its presence with the master
ObjectFactoryBase at runtime? There is a mention of ITK_AUTOLOAD_PATH in =
the
documentation; do I just put the DLL containing the object and its =
object
factory into this path? What is this path and how would I modify it? I =
would
really appreciate some step-by-step instructions or sample code for
accomplishing this. Thanks in advance.
=20
Best regards,
-Parag Chandra
------=_NextPart_000_0018_01C31A32.3C1EBC00
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 10 (filtered)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{font-family:Arial;
color:windowtext;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=3DEN-US link=3Dblue vlink=3Dpurple>
<div class=3DSection1>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Hi,</span></font></p>
<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'> </span></font></p>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>I am trying to use the DynamicLoader and ObjectFactory mechanism =
to create
subclasses which can be packaged into shared libraries and then loaded =
dynamically
at runtime. I know that the ImageIO framework was designed to allow this =
sort
of behavior, but I don’t understand all the details of how to make =
it
work. Looking at ImageIOFactory, it’s clear that =
ObjectFactoryBase::CreateAllInstance
is called in order to create all the registered subclasses of a =
particular base
class. Each of these subclasses is then queried to determine which, if =
any, is
the correct one to handle a particular image format. However, all of =
these
subclasses are essentially linked in statically at compile time, and =
their
corresponding factories are explicitly registered via =
ImageIOFactory::RegisterBuiltInFactories.
If I wrote a new ImageIO class and packaged it as a shared library, how =
would I
get it to automatically register its presence with the master =
ObjectFactoryBase
at runtime? There is a mention of ITK_AUTOLOAD_PATH in the =
documentation; do I
just put the DLL containing the object and its object factory into this =
path?
What is this path and how would I modify it? I would really appreciate =
some
step-by-step instructions or sample code for accomplishing this. Thanks =
in
advance.</span></font></p>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'> </span></font></p>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>Best regards,</span></font></p>
<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>-Parag Chandra</span></font></p>
</div>
</body>
</html>
------=_NextPart_000_0018_01C31A32.3C1EBC00--