<HTML><BODY><p style="margin-top: 0px;" dir="ltr">Yes I know this did you see my reply and code</p> 
<div id="mail-app-auto-default-signature">
 <p dir="ltr">--<br> Thanks<br> Brian</p>
</div>Sunday, 24 May 2020, 04:58PM -07:00 from Bruce <a href="mailto:adamnt42@gmail.com">adamnt42@gmail.com</a>:<br><br><blockquote id="mail-app-auto-quote" cite="15903647000000015033" style="border-left:1px solid #0878BD; margin:0px 0px 0px 10px; padding:0px 0px 0px 10px;">
        



    









        
        


        
        
        
        
        

        
        

        
        



<div class="js-helper js-readmsg-msg">
        <style type="text/css"></style>
        <div >
                <base target="_self" href="https://e-aj.my.com/" />
                
                        <div id="style_15903647000000015033_BODY"><br>
<br>
On 25/5/20 1:51 am, Brian G wrote:<br>
> <br>
> I am trying to access the methods in the main module not class from one of the loaded plugins.<br>
> <br>
> <br>
<br>
OK!  A couple of points:<br>
1) In you main project the classes you want visible in the plugin must <br>
be exported and<br>
2) (Obviously) the methods you want to expose to the plugin must be public.<br>
<br>
Here's what I think you are trying:<br>
MAIN PROGRAM "Main" module<br>
--------------------------<br>
' Gambas module file<br>
<br>
Export<br>
<br>
Public Sub Main()<br>
<br>
   Dim hXXX As Object<br>
<br>
   Component.Load("ph.plugin")<br>
   ' Print Class.IsLoaded("PluginA")<br>
<br>
   hXXX = Object.New("PluginA")<br>
<br>
Catch<br>
   Error Subst("&1\nERR: &2 (&3)\n&4\n&1\n", String$(40, "-"), <br>
Error.Text, Error.Code, Error.Backtrace.Join("\n"))<br>
<br>
End<br>
<br>
Public Function Addup(nums As Integer[]) As Integer<br>
   Dim iTot As Integer<br>
   For idx As Integer = 0 To nums.Max<br>
     iTot += nums[idx]<br>
   Next<br>
   Return iTot<br>
End<br>
<br>
PLUGIN COMPONENT "PluginA" class<br>
--------------------------------<br>
' Gambas class file<br>
<br>
Export<br>
<br>
Public Sub _new()<br>
<br>
   Dim cxx As Class = classes["Main"]<br>
   Print object.call(cxx, "Addup", [[1, 5, 2, 5, 9]])<br>
<br>
End<br>
<br>
b<br>
<br>
----[ <a href="http://gambaswiki.org/wiki/doc/netiquette" target="_blank" >http://gambaswiki.org/wiki/doc/netiquette</a> ]----<br>
</div>
                        
                
                <base target="_self" href="https://e-aj.my.com/" />
        </div>

        
</div>


</blockquote></BODY></HTML>