<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Custom lib can't call other libs</title>
    <link>http://www.mapleprimes.com/questions/96826-Custom-Lib-Cant-Call-Other-Libs</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Fri, 12 Jun 2026 11:15:14 GMT</lastBuildDate>
    <pubDate>Fri, 12 Jun 2026 11:15:14 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Custom lib can't call other libs</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Custom lib can't call other libs</title>
      <link>http://www.mapleprimes.com/questions/96826-Custom-Lib-Cant-Call-Other-Libs</link>
    </image>
    <item>
      <title>don't use `with` for this</title>
      <link>http://www.mapleprimes.com/questions/96826-Custom-Lib-Cant-Call-Other-Libs?ref=Feed:MaplePrimes:Custom lib can't call other libs:Comments#answer96829</link>
      <itunes:summary>&lt;p&gt;Using with(MyLib) as a way to resolve the name `h` as used inside the already authored or loaded package AnotherPackage is bad form (and this is an example of why). Also, it really matters which version (global, or export of MyLib) of the name `h` is bound when AnotherPackage is defined and saved,&lt;/p&gt;
&lt;p&gt;I suggest that you write AnotherPackage using the syntax MyLib:-h() inside the code of AnotherPackage, whenever you need to call export `h` of MyLib.&lt;/p&gt;
&lt;p&gt;If done that way, properly, you shouldn't even have to with(MyLib) in order to `with` or use AnotherPackage. You'd just have to make sure that MyLib is accessible in the libname path whenever you used AnotherPackage.&lt;/p&gt;
&lt;p&gt;You might also utilize `use`, but there are some caveats abour which form works I think (and `uses` might not be ok at all).&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Using with(MyLib) as a way to resolve the name `h` as used inside the already authored or loaded package AnotherPackage is bad form (and this is an example of why). Also, it really matters which version (global, or export of MyLib) of the name `h` is bound when AnotherPackage is defined and saved,&lt;/p&gt;
&lt;p&gt;I suggest that you write AnotherPackage using the syntax MyLib:-h() inside the code of AnotherPackage, whenever you need to call export `h` of MyLib.&lt;/p&gt;
&lt;p&gt;If done that way, properly, you shouldn't even have to with(MyLib) in order to `with` or use AnotherPackage. You'd just have to make sure that MyLib is accessible in the libname path whenever you used AnotherPackage.&lt;/p&gt;
&lt;p&gt;You might also utilize `use`, but there are some caveats abour which form works I think (and `uses` might not be ok at all).&lt;/p&gt;</description>
      <guid>96829</guid>
      <pubDate>Sun, 12 Sep 2010 19:11:17 Z</pubDate>
      <itunes:author>pagan</itunes:author>
      <author>pagan</author>
    </item>
    <item>
      <title>Doesn't work</title>
      <link>http://www.mapleprimes.com/questions/96826-Custom-Lib-Cant-Call-Other-Libs?ref=Feed:MaplePrimes:Custom lib can't call other libs:Comments#comment96832</link>
      <itunes:summary>&lt;p&gt;I'm not sure, I understood correctly: So you suggest I replace each occurance of h() inside the code of f1 of the package MyLib with "AnotherPackage:-h()"? I think this is the same as I've done via "AnotherPackage[h]".&lt;/p&gt;
&lt;p&gt;I tried it that way and it didn't work either.&lt;/p&gt;
&lt;p&gt;Maybe I should clarify:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; There are 2 Packages:&amp;nbsp; MyLib and AnotherPackage.&lt;/li&gt;
&lt;li&gt;Mylib contains a function f1 which calls AnotherPackage[h]&lt;/li&gt;
&lt;li&gt;I try to run everything via "with(MyLib);" and "with(AnotherPackage)" (while the latter might be unnecessary as pointed out by pagan).&lt;/li&gt;
&lt;/ul&gt;</itunes:summary>
      <description>&lt;p&gt;I'm not sure, I understood correctly: So you suggest I replace each occurance of h() inside the code of f1 of the package MyLib with "AnotherPackage:-h()"? I think this is the same as I've done via "AnotherPackage[h]".&lt;/p&gt;
&lt;p&gt;I tried it that way and it didn't work either.&lt;/p&gt;
&lt;p&gt;Maybe I should clarify:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt; There are 2 Packages:&amp;nbsp; MyLib and AnotherPackage.&lt;/li&gt;
&lt;li&gt;Mylib contains a function f1 which calls AnotherPackage[h]&lt;/li&gt;
&lt;li&gt;I try to run everything via "with(MyLib);" and "with(AnotherPackage)" (while the latter might be unnecessary as pointed out by pagan).&lt;/li&gt;
&lt;/ul&gt;</description>
      <guid>96832</guid>
      <pubDate>Sun, 12 Sep 2010 20:57:39 Z</pubDate>
      <itunes:author>hanswurst</itunes:author>
      <author>hanswurst</author>
    </item>
    <item>
      <title>code</title>
      <link>http://www.mapleprimes.com/questions/96826-Custom-Lib-Cant-Call-Other-Libs?ref=Feed:MaplePrimes:Custom lib can't call other libs:Comments#comment96839</link>
      <itunes:summary>&lt;p&gt;It's not clear (yet) whether you intend to create AnotherPackage before or after you create MyLib, and whether you intend on savelib'ing AnotherPackage so as to access it in a new session or recreate it on the fly. Is this code sample below enough to get you going?&lt;/p&gt;
&lt;p&gt;Notice that I never issue the command &lt;strong&gt;with(AnotherPackage)&lt;/strong&gt;.&lt;/p&gt;
&lt;pre&gt;&amp;gt; restart;  
&amp;gt; try
&amp;gt;  FileTools:-Remove("c:/tmp/MyLib.lib"):
&amp;gt;  FileTools:-Remove("c:/tmp/MyLib.ind"):
&amp;gt; catch:
&amp;gt; end try:
&amp;gt; march('create', "c:/tmp/MyLib.lib"):

&amp;gt; MyLib:= module()
&amp;gt; export f1;
&amp;gt; local g1, g2; 
&amp;gt; option package;
&amp;gt;  f1 := proc(x)
&amp;gt;         AnotherPackage:-h(x);
&amp;gt;        end proc: 
&amp;gt; end module:

&amp;gt; savelibname:="c:/tmp":
&amp;gt; savelib( `MyLib` );

&amp;gt; AnotherPackage := module()
&amp;gt; export h;
&amp;gt;  h := proc(x)
&amp;gt;        x^2+sin(x);
&amp;gt;       end proc:
&amp;gt; end module:

&amp;gt;MyLib:-f1(z);
                           2         
                          z  + sin(z)

&amp;gt;restart:

&amp;gt;libname:=libname,"c:/tmp":
&amp;gt; MyLib:-f1(z); # expect an error here
Error, (in MyLib:-f1) `AnotherPackage` does not evaluate to a module

&amp;gt; AnotherPackage := module()
&amp;gt;  export h;
&amp;gt;  h := proc(x)
&amp;gt;        x^2+sin(x);
&amp;gt;       end proc:
&amp;gt; end module:

&amp;gt; MyLib:-f1(z);
                           2         
                          z  + sin(z)

&amp;gt; savelibname:="c:/tmp":
&amp;gt; savelib( `AnotherPackage` );

&amp;gt; restart:
&amp;gt; libname:=libname,"c:/tmp":
&amp;gt; MyLib:-f1(z);
                           2         
                          z  + sin(z)
&lt;/pre&gt;</itunes:summary>
      <description>&lt;p&gt;It's not clear (yet) whether you intend to create AnotherPackage before or after you create MyLib, and whether you intend on savelib'ing AnotherPackage so as to access it in a new session or recreate it on the fly. Is this code sample below enough to get you going?&lt;/p&gt;
&lt;p&gt;Notice that I never issue the command &lt;strong&gt;with(AnotherPackage)&lt;/strong&gt;.&lt;/p&gt;
&lt;pre&gt;&amp;gt; restart;  
&amp;gt; try
&amp;gt;  FileTools:-Remove("c:/tmp/MyLib.lib"):
&amp;gt;  FileTools:-Remove("c:/tmp/MyLib.ind"):
&amp;gt; catch:
&amp;gt; end try:
&amp;gt; march('create', "c:/tmp/MyLib.lib"):

&amp;gt; MyLib:= module()
&amp;gt; export f1;
&amp;gt; local g1, g2; 
&amp;gt; option package;
&amp;gt;  f1 := proc(x)
&amp;gt;         AnotherPackage:-h(x);
&amp;gt;        end proc: 
&amp;gt; end module:

&amp;gt; savelibname:="c:/tmp":
&amp;gt; savelib( `MyLib` );

&amp;gt; AnotherPackage := module()
&amp;gt; export h;
&amp;gt;  h := proc(x)
&amp;gt;        x^2+sin(x);
&amp;gt;       end proc:
&amp;gt; end module:

&amp;gt;MyLib:-f1(z);
                           2         
                          z  + sin(z)

&amp;gt;restart:

&amp;gt;libname:=libname,"c:/tmp":
&amp;gt; MyLib:-f1(z); # expect an error here
Error, (in MyLib:-f1) `AnotherPackage` does not evaluate to a module

&amp;gt; AnotherPackage := module()
&amp;gt;  export h;
&amp;gt;  h := proc(x)
&amp;gt;        x^2+sin(x);
&amp;gt;       end proc:
&amp;gt; end module:

&amp;gt; MyLib:-f1(z);
                           2         
                          z  + sin(z)

&amp;gt; savelibname:="c:/tmp":
&amp;gt; savelib( `AnotherPackage` );

&amp;gt; restart:
&amp;gt; libname:=libname,"c:/tmp":
&amp;gt; MyLib:-f1(z);
                           2         
                          z  + sin(z)
&lt;/pre&gt;</description>
      <guid>96839</guid>
      <pubDate>Mon, 13 Sep 2010 04:43:47 Z</pubDate>
      <itunes:author>pagan</itunes:author>
      <author>pagan</author>
    </item>
  </channel>
</rss>