-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling external library #21
Comments
If this library targets .NET Framework, it might not be compatible with .NET Core, but it's worth a shot. julia> using DotNET
julia> T"System.Reflection.Assembly".LoadFrom(raw"C:\Windows\Microsoft.NET\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.dll") # Path to WPF PresentationFramework.dll on your computer
System.Reflection.RuntimeAssembly("PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
julia> T"System.Reflection.Assembly".Load("PresentationFramework") # Now Assembly.Load works
System.Reflection.RuntimeAssembly("PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
|
Thanks, it works after loading the PresentationFramework! Quick additional question, how can I access enumerations? import clr
clr.AddReference("C:\\Program Files\\Thorlabs\\Kinesis\\Thorlabs.MotionControl.DeviceManagerCLI.dll")
from Thorlabs.MotionControl.DeviceManagerCLI import *
DeviceConfiguration.DeviceSettingsUseOptionType.UseFileSettings
DeviceConfiguration.DeviceSettingsUseOptionType.UseDeviceSettings
DeviceConfiguration.DeviceSettingsUseOptionType.UseConfiguredSettings Thanks |
Enum types are accessed in the same way as other types, by specifying the fully qualified type name. And each enum value is a property of its type. julia> T"System.DateTime".new(Int32(2003), Int32(5), Int32(1)).DayOfWeek.Equals(T"System.DayOfWeek".Thursday)
true |
Thanks! I managed to get access to the enumeration. However, the path is non intuitive relatively to the python example which matches the documentation: T"System.Reflection.Assembly".LoadFrom("C:\\Program Files\\Thorlabs\\Kinesis\\Thorlabs.MotionControl.DeviceManagerCLI.dll")
options = T"Thorlabs.MotionControl.DeviceManagerCLI.DeviceSettingsSectionBase+SettingsUseOptionType, Thorlabs.MotionControl.DeviceManagerCLI"
options.UseFileSettings
# Thorlabs.MotionControl.DeviceManagerCLI.DeviceSettingsSectionBase+SettingsUseOptionType("UseFileSettings") Thanks again for this package and the help! |
Hello,
I am trying to use an external library called Kinesis from Thorlabs.
I can access the library but I run into an error because the software cannot find
PresentationFramework
I get the following error:
Thanks
The text was updated successfully, but these errors were encountered: