Garuda/Eagle in starpack
Not logged in
This forum is sponsored by Mistachkin Systems.
Eagle: Secure Software Automation
(This is the rewrite of my post to comp.lang.tcl. I thought it was a not good place to post this kind of a question.)

Is it possible for a starpack-wrapped Tcl/Tk application to use external .NET assemblies using Garuda? I use the latest build (1.0.7900.33333, 2021-08-23).

My Tcl/Tk application is wrapped into a starpack with ActiveState TclApp. I wanted to check if Garuda can work with my app.

Ideally, I want to embed Eagle.dll and Garuda.dll into my starpack but at first, I just installed Eagle/Garuda binaries to the lib folder under the working directory and inserted the path to the head of ::auto_path.

The purpose to use Garuda is to load an external managed assembly from the local sub-folder. The assembly is dependent on several DLLs in the same folder. I keep them out of my starpack.

```
+ lib\
  + Garuda-1.0\
    + dotnet.tcl
    + Eagle.dll
    + Garuda.dll
    + helper.tcl
    + pkgIndex.tcl
+ GRPCRemoteClient\
  + Google.Protobuf.dll
  + Grpc.Core.Api.dll
  + Grpc.Core.dll
  + grcp_csharp_ext.x86.dll
  + GRPCRemoteClient.dll (This is the DLL to be loaded from MyApp.tcl)
  + System.Buffers.dll
  + System.Memory.dll
  + System.Numerics.Vectors.dll
  + System.Runtime.CompilerServices.Unsafe.dll
+ MyApp.exe (MyApp.tcl wrapped into exe.)
```

**MyApp.tcl** is the main script. It loads Garuda.
The eagle command loads **GRPCRemoteClient/GRPCRemoteClient.dll** and the classes and the methods are used. The other DLLs in **GRPCRemoteClient** folder are loaded by **GRPCRemoteClient.dll**.

If **MyApp.tcl** is not wrapped into a starkit, it works well.
However, if it is wrapped, it can't create any instance of classes defined inside **GRPCRemoteClient.dll**, although it seemed to load **GRPCRemoteClient.dll** successfully.

I followed the instruction in this article and added **METHOD_PROTOCOL_V1R2** flag before loading Garuda package.

[](https://wiki.tcl-lang.org/page/Garuda)

```
# MyApp.tcl

set exehome [pwd]
set auto_path [linsert $auto_path 0 [file join $::exehome lib]]

namespace eval ::Garuda {
    variable methodFlags 0x40; # METHOD_PROTOCOL_V1R2
}

package require Garuda

eagle {
    object invoke System.Reflection.Assembly LoadFrom ./GRPCRemoteClient/GRPCRemoteClient.dll
}

# => {GRPCRemoteClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null} c199bf34-6a72-4256-8e1c-5857959232ad 293
# => Seemed successful.

eagle {
    object create -alias GRPCRemote.GRPCRemoteClient "127.0.0.1" 50051
}

# => {type "GRPCRemote.GRPCRemoteClient" not found} {expected type value but got "GRPCRemote.GRPCRemoteClient"}
# => Failed.
```