Since [info assembly] returned the path to Eagle.dll, I used a global variable which has the folder of the target DLLs.
### MyApp.exe
```
proc assemblyResolve { sender e } {
global dll_dir
regexp {^([^,]+),.+$} [$e Name] -> name
log "name = $name"
set fileName [file join $dll_dir $name.dll]
log "fileName=$fileName"
set type [object load -loadtype File $fileName]
log "type=$type"
return $type
}
proc load_type {dll_path} {
set type [object load -import -loadtype File $dll_path]
log "type=$type"
return $type
}
proc call_tcl {script} {
tcl eval [tcl primary] $script
}
proc log {msg} {
call_tcl [list puts $msg]
}
proc get_client {} {
set host "127.0.0.1"
set port 50051
object create -alias GRPCRemote.GRPCRemoteClient $host $port
}
set appDomain [object invoke -alias AppDomain CurrentDomain]
$appDomain -marshalflags +DynamicCallback add_AssemblyResolve assemblyResolve
set dll_dir [file normalize "GRPCRemoteClient"]
set dll_file "GRPCRemoteClient.dll"
set dll_path [file join $dll_dir $dll_file]
if {[catch {load_type $dll_path} err]} {
log $errorInfo
}
if {[catch {get_client} client]} {
log $errorInfo
}
```
The AssemblyResolve delegate loaded two dependent assemblies but finally eagle could not load all the assemblies needed for GRPCRemoteClient.dll to work.
### log
```
name = Google.Protobuf
fileName=C:/Users/yusuke/Documents/devel/IAS/PerkinElmer/Syngistix SDK v2/210914/Garuda-Syngistix/GRPCRemoteClient/Google.Protobuf.dll
type={Google.Protobuf, Version=3.12.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604} e280b797-c0cd-438d-9770-77b6d396d79e 316
name = Grpc.Core.Api
fileName=C:/Users/yusuke/Documents/devel/IAS/PerkinElmer/Syngistix SDK v2/210914/Garuda-Syngistix/GRPCRemoteClient/Grpc.Core.Api.dll
type={Grpc.Core.Api, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad} 480c6bff-dbc7-4d31-9c4e-de5aa2eda1e1 340
type={GRPCRemoteClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null} c199bf34-6a72-4256-8e1c-5857959232ad 299
type={GRPCRemoteClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null} c199bf34-6a72-4256-8e1c-5857959232ad 299
{type "GRPCRemote.GRPCRemoteClient" not found} {expected type value but got "GRPCRemote.GRPCRemoteClient"}
while executing
"object create -alias GRPCRemote.GRPCRemoteClient $host $port"
(procedure "get_client" line 4)
invoked from within
"get_client"
("catch" body line 1)
```