I developed a cross-platform SDK in C#, therefore I have this PCL libraries with profiles including .Net45 and .Net40.
To implement an automation scriptable tool, I was thinking to reference the library from some scripting language like powershell (any other/better option?) but not sure how to do that or if it is possible at all? Especially considering that all the SDK calls are asynchronous.
I can't see any reason why this isnt possible. Just include the dll using Add-Type and use it.
Related
came across several post but doesn't seem to be able to find a definite answer as to how do one integrate ZeroMQ and Unity without the use of a wrapper/dll.
Wanting to use a Pub/Sub method, so it would be nice if someone is able to assist on this as well.
P/S using VS Code.
Tried copying the entirety of https://github.com/zeromq/netmq/tree/master/src/NetMQ and pasting it into Unity's Asset/Plugin but unable to compile. See Image
Also saw that someone said to use the lib folder in clrzmq and paste it inside netmq, but still unable to compile.
The standard way to use libraries is to import them using nuget. This ensures any other dependencies are included.
I have not used unity3D, but there seem to be a asset to import nuget packages. See this post for more info.
From the NetMQ homepage:
NetMQ is a 100% native C# port of ZeroMQ
This means you do not need clrzmq or any other native library. You still need the dll for NetMQ, but .net dlls are typically easier to include and use than wrappers around native libraries.
Note that NetMQ uses LGPL license, that means you can use the dll for the library. But if you actually include the source code that would mean your whole game would also need to be licensed under LGPL.
I am trying to use this code in a Unity project, but it seems the implementations of COM Interop in Mono/.NET differs, which causes the code to fail or crash. Running the code in .NET works fine, but running it with Mono 2.0 (outside of Unity) fails in the same way as in Unity, suggesting it is a problem with Mono in general and not Unity.
If I compile and run the code as-is, it fails because the type cast from MMDeviceEnumerator to IIMMDeviceEnumerator fails. When decorating all interfaces with [ComInterop], the cast succeeds, but the call to GetDefaultAudioEndpoint crashes Unity/Mono with an Access Violation.
It is hard to find good documentation of COM Interop on Mono in general - and particularly so regarding such an old version. Is it at all possible to get this running?
Wrap the COM functions in C funtions and call the C functions via P/Invoke instead. This can be done in two steps:
Create a VC++ project that wraps the functions you needed in wasapi. Expose them via a module define file or __declspec(dllexport). Build the code into a dll that exposes the functions you need.
In your Unity3D project, access them via P/Invoke.
Here is an example. In your case, just use the COM code in the C/C++ part to do what you want.
Mono 1.0 and Mono 1.1.xx do not have support for COM.
Stop trying with Mono, Mono is for platform independence and COM Interop is Microsoft only. Use open source SDKs for Video Playing or better invoke apps from command line like vlc to play, encode etc.
I have a lot of business logic coded in C#. I donĀ“t know a lot about Xamarin, but as far as I know, you have to use the full framework. What I would like to do is just use Xamarin to compile the business logic into an android DLL and then code the Android app using them. Is it possible?
Thanks.
Depends on what code you actually have in your business objects.
Xamarin uses Mono which is open source port of .NET. It then takes the Mono code and compiles that to Android. Any 3rd party libraries you have referenced or use probably will not work. You would need to find a Mono library (still may be incompatible on Android) or an Android library that has the functionality you need and re-code those parts.
Xamarin does have the ability (with paid version) that let you to reference Java Jars and work with them in your C# Android project. This is most beneficial when the .NET/Mono library you were using does not work in Android, but an equivalent Android or Java library does.
Again, it is really up to whether or not any of the classes you use outside of your own have been implemented in Mono and then implemented in the Android versions of it.
I am building a portable library targeting Windows 8.1. I need to encrypt a password to send it across an http connection. The problem is that System.Security.Cryptography is not available in portable libraries.
The only solution that I've been able to find is the PCL Contrib, but it seems far too bulky to add that to my project. I was also getting some runtime exceptions in PCL Contrib that I couldn't resolve.
I am sure that there has to be a simple solution out there, but I haven't been able to find any that doesn't use System.Security.Cryptography. Does anyone know of a simple to use encryption that can be used in a portable library?
Use PCLCrypto. It offers WinRT-like APIs for cryptography, but it works on all the modern platforms.
Ahead of Time Compilation or AOT is a feature of the Mono runtime code generator.
mono --aot program.exe
This will generate a file called "program.exe.so"
How can i load this shared object file in php script and access the class objects and methods. ?
Thanks
The native library still needs to be loaded inside an AppDomain (i.e. the Mono VM/runtime) in order to run, it is not a native library as such.
If you must I'd suggest looking at
whether php supports COM interop (I don't use php, but I'd reckon the chance exists). This would be good since you could use that and profit from OO interface exposure
Use Swig which has support for C# some time now
Alternatively, use mkbundle, and/or create a native shared library that embeds a Mono VM. The shared library wrrap around the C# interface using a "C" native API's.
The Phalanger project should be able to do this. You can compile your php code with mono and also integrate with .net from php.