<HTML>
	<HEAD>
    	<TITLE>Adobe ExtendScript Toolkit</TITLE>
		<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
		<LINK HREF="adobe.css" REL="stylesheet" TYPE="text/css">
        <LINK HREF="tabs.css" REL="stylesheet" TYPE="text/css">
 	</HEAD>
<BODY> 
    <div class="header"><a href="http://www.adobe.com"><img src="adobelogo.jpg" alt="http://www.adobe.com"></a>&nbsp;<b>ExtendScript ToolKit</b></div>
<!-- Generated by Doxygen 1.5.5 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li class="current"><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
    </ul>
  </div>
</div>
<!-- Generated by Doxygen 1.5.1-p1 -->
<h1><a class="anchor" name="installing">Installing External Objects</a></h1><h2><a class="anchor" name="intro_sec">
Introduction</a></h2>
These pages describe getting started with external objects, which you can use to extend the ExtendScript DOM and call into shared libraries of your own written in C/C++.<p>
External objects are a key extensibility pattern for Adobe  applications that integrate ExtendScript. You might want to use them to call into your own existing platform-native libraries or exploit the ability to call into C/C++ code of your own from a scripting context.
<h2><a class="anchor" name="create_sec">
Installing a Compiled External Object</a></h2>
<h3><a class="anchor" name="step1">
Step 1: Installing</a></h3>
The External Objects sample should compile and work with the libraries (DLLs or frameworks) in the locations that they are compiled to; this is where the sample JavaScript files provided expect the libraries to be located.<p>
Once you have successfully compiled and tested the sample code with the provided sample scripts, you should be aware of the recommended deployment pattern for these extensions like your External Object library, which is effectively a plug-in. If you change the location of the libraries to this location, be sure to change the paths in JavaScript files that load the libraries accordingly.
<p>
The recommended location for extensions is different for each application so check their Programmer's Guide.
<h3><a class="anchor" name="step2">
Step 2: Loading and Unloading</a></h3>
To load an external library from JavaScript, use the ExternalObject constructor: <div class="fragment"><pre class="fragment"> var myObj = <span class="keyword">new</span> ExternalObject (<span class="stringliteral">"lib:"</span> + libName); 
</pre></div><p>
The constructor can take an arbitrary number of arguments, which are passed on to the library's initialization routine:

<div class="fragment"><pre class="fragment"> myObj = <span class="keyword">new</span> ExternalObject (<span class="stringliteral">"lib:"</span> + libName, arg1, arg2); 
</pre></div><p>
The specifier "lib:" is case sensitive. The library name can be the base name of the shared library as well as include the path to the library: Note: the ExternalObject architecture in future may be extended to wrap other types of external data; at present "lib:" is the marker for dynamically linked libraries.

<div class="fragment"><pre class="fragment">  var libName = <span class="stringliteral">"C:\myLibraries\myLib.dll"</span>;
  var myObj = <span class="keyword">new</span> ExternalObject (<span class="stringliteral">"lib:"</span> + libName);
</pre></div><p>
If the loader cannot load the library by its given name, it appends a file extension according to the operating system:

<ul>
<li>Windows: .DLL </li>
<li>Mac: .framework</li>
</ul>
If the library name does not contain a path specifier, but just the name of the library, then the loader first looks into the current folder for the library, which will be the application startup folder. If attaching the default extension does not work, the loader will then check the plug-ins folder within the program startup folder, Bridge for example would be:
<ul>
<li><b>Win</b> - C:/Program Files/Adobe/Adobe Bridge CS3/Plug-Ins</li>
</ul>
<ul>
<li><b>Mac</b> - /Applicationw/Adobe Bridge CS3/Plug-Ins</li>
</ul>
If you are following the recommendations above and using the chosen Application's Extensions directory, the library could be loaded as follows from a script executing from the root level of your "MyExtensions" folder, by writing: 
<div class="fragment"><pre class="fragment">  Folder.current = File ($.fileName).parent;
  var myLib = <span class="keyword">new</span> ExternalObject(<span class="stringliteral">"lib:Plugins/myLib.dll"</span>);
</pre></div><p>
To unload a library, call the object's unload() method. This method unloads the library and leaves the object in an invalid state. Any attempts to access properties or methods of the library object once unloaded result in a runtime error. <div class="fragment"><pre class="fragment">  myLib.unload();
</pre></div><p>
See <a class="el" href="sampleprojects.html">Using the Sample Projects</a> for information on how to find the sample projects<p>
See <a class="el" href="basicexernalobject_p.html">Using the BasicExternalObject Sample</a> for information on how to build the External Object sample
<p>
See <a class="el" href="samplelib_p.html">Using the SampleLib Example</a> for information on how to build the Sample Lib sample.
<p>
<p><img src="1ptrans.gif"  /></p>
<p><img src="asn.gif" width="114" height="45" border="0" alt="Adobe Solutions Network"></p>
<p>Copyright&#169; 2008 Adobe Systems Incorporated. All rights reserved.</p>
<p>
    	<a href="http://www.adobe.com/misc/copyright.html">Terms of Use</a>&nbsp;
        <a href="http://www.adobe.com/misc/privacy.html">Online Privacy Policy</a>&nbsp;
        <a href="http://access.adobe.com">Adobe and accessibility</a>&nbsp;
        <a href="http://www.adobe.com/aboutadobe/antipiracy/main.html">Avoid software piracy</a>&nbsp;
        <a href="http://www.adobe.com/misc/agreement.html">Permissions and Trademarks</a>
</p>
</body>
</html>