Using MATLAB Compiler Runtime (mcr) i have created dll of the entropy.m choosing FrameWork version 4.0. I have added this dll to c# references. Also i have to add MWArray.dll to create the needed paramters for methods.
> public class Entropy : IDisposable
> {
> //Constructors,Finalize,Methods,Class Members are located here.
> }
> using com.Entropy;
> using MathWorks.MATLAB.NET.Arrays;
> using MathWorks.MATLAB.NET.Utility;
Here is my problem. I am trying to get an instance of Entropy class like
Entropy ep = new Entroyp();
However it throws an exception that says:
> The type initializer for 'com.Enthropy.Enthropy threw an exception.
Also while i try to create an MWNumericArray it throws the same exception. I've tried to change framework version of my project to 4.0 but it did not work. What is the reason of this error?
In addition i've looked at links below.
ACCESSING MATLAB FUNCTIONS FROM C#.NET
Using MATLAB Builder NE
Is there an example of using the "MWArray" data type in a .NET language such as C# with a MATLAB Builder for .NET component?
Okay. After installing the MCR, i have done everything at the beginning. Created the dll of entropy.m. Then i opened an earlier version of my project, i mean i deleted the added references; MWArray.dll and Entropy.dll. After that i have added those references to my project back. Now it works fine.
The important points:
1)Before create a dll file of any MatLab function INSTALL MCR.
2)While creating dll try to give different names to class and project. I mean if you create project that name is Entropy.prj dont create your class name as Entropy.
3)Don't forget to add MWArray.dll to your project. Its location is
(..//Program Files(x86)//MATLAB\MATLAB CompilerRuntime\v81\toolbox\dotnetbuilder\bin\win32\v2.0)
Related
I'm building an extension for a program (.NET Class library) where I want to use GDAL. I have installed GDAL and GDAL.Native via Nuget. I previously tested my function in a separate Console App, and everything was working fine.
But when I use the function in my Class Library and load it into the program, it's giving an error during the GdalConfiguration:
The type initializer for 'OSGeo.GDAL.GdalPINVOKE' threw an exception. at OSGeo.GDAL.GdalPINVOKE.SetConfigOption(String jarg1, String jarg2)
at OSGeo.GDAL.Gdal.SetConfigOption(String pszKey, String pszValue)
at MyGdal.GdalConfiguration..cctor() in C:....MyGdal\GdalConfiguration.cs:line 98
In Line 98 the configuration for variable "GDAL_DATA" is set:
// Set the additional GDAL environment variables.
string gdalData = Path.Combine(gdalPath, "data");
Environment.SetEnvironmentVariable("GDAL_DATA", gdalData);
Gdal.SetConfigOption("GDAL_DATA", gdalData);
Does anyone know why this variable cannot be set when using the function in the program but it works when using it in a Console App? I have tried to reference the Console App to my Class Library and call the function from there, but it is giving te same error.
I am attempting to build and use the MicoCharts project available here: https://github.com/dotnet-ad/Microcharts which is dependant on this SkiaSharp project available here: https://github.com/mono/SkiaSharp
The specific version I am attempting to use is 15.9.1 (the version that the nuget package downloads) which utilizes skia m59.
I need to build them myself and cannot use Nuget due to business restrictions, just use the package isn't an option for me.
I have built skia m59, SkiaSharp and MicroCharts but when I attempt to create a SKBitmap object I get an error when it attempts to initialize SkiaSharp.SKImageInfo. The error is as follows:
Unable to find an entry point named 'sk_color_get_bit_shift' in DLL 'libSkiaSharp'.
I had to make a few changes to the base BUILD.gn to point to the correct file locations, for the windows SDK and the VC install. I enabled skia_use_gdi in the BUILD.gn and ran the following commands.
python2 tools/git-sync-deps
gn gen out/Release --args="is_debug=false is_official_build=true skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false skia_use_icu=false is_component_build=true"
ninja -C out/Release skia
This process outputs a DLL I assumed is the same as the libSkiaSharp that the SkiaSharp project relies on. I add all my references and run, the project runs successfully until I attempt to create the SkBitmap object then it fails.
Either this DLL is not the correct DLL and I am misunderstanding something here or something in my process is wrong. I would love any help I can get as I am completely new to building these sorts of projects, I am a C# developer by trade.
This is not the same thing. SkiaSharp has a few other bits that it adds to the core skia. The output that you would have got is a skia.dll, which only part. Not sure how you got a libSkiaSharp from the skia target...
If you can't use SkiaSharp from NuGet.org (which is the supported case) you can follow this to build your own: https://github.com/mono/SkiaSharp/wiki/Building-SkiaSharp
You can also check out the Azure DevOps yaml: https://github.com/mono/SkiaSharp/blob/master/scripts/azure-pipelines.yml
Just set up your own DevOps job to use that and all the work will be done for you.
I used IKVM to convert slf4j to dll's for use in a c# program. It's throwing me an exception. (NoClassDefFoundError was unhandled org.slf4j.LoggerFactory)
The code is as follows
acceptor = new SocketAcceptor();
connectionHandler = new ConnectionHandler();
serverlistenerPort = 32156;
SocketAcceptorConfig sac = new SocketAcceptorConfig();
sac.getSessionConfig().setTcpNoDelay(false);
sac.setReuseAddress(true);
sac.setBacklog(100);
//The following line is what seems to hate me.
acceptor.bind(new InetSocketAddress(serverlistenerPort), connectionHandler, sac);
Connection Handler is a class I have that overrides IoHandler(a mina class) I have triple checked that I have all the IKVM dll's referenced, and I've searched every possible combination of terms on Google for a solution, but when all the solutions are for Java and they just need to reference .jar files. I'm certain I have all the .dll's referenced (This works as a java program using jars)
I had the same issue. I used this command to get the dll compiled:
ikvmc -sharedclassloader file1.jar ...... file8.jar
should be OK for what I've read, shouldn't it?
And then used this to get the dll into the global cache:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64> gacutil -i "C:\ikvm-7.1.4532.2\bin\IKVM.OpenJDK.Core.dll"
and same command to put all the partial libraries needed
I have a project that I'm upgrading from 2008 to 2010.
My problem is with the code being generated by a service reference. Any classes used in the Reference.cs are given by their full name according to the reference
The difference results in a 'cannot convert from foo.Data.MtkBaseRequest to foo.WebServicesClient.ModelDataService.MtkBaseRequest'
So I have the old code
namespace foo
{
public abstract class MtkBaseRequest{}
}
And this code being called
List<MtkBaseRequest> newList = new List<MtkBaseRequest>(requestArray);
this.DataAccessWebService.doStuff(newList);
but this is the method it means to call(which is generated)
public void doStuff(System.Collections.Generic.List<foo.WebServicesClient.ModelDataService.MtkBaseRequest> requests)
So what's happening is that the namespace no longer matches for the class which should be the same. In the code generated by VS 2008 the method being called is:
public void doStuff(System.Collections.Generic.List<foo.Data.MtkBaseRequest> requests)
Is there a work-around, or something I can do to get the code generating properly?
BTW: the project this is in is called WebServicesClient, the service reference is ModelDataService
I fixed it, turns out there were some assemblies hanging around in the GAC.
stupid GAC
i have created a C# dll file on my machine as shown below:
namespace myDLL
{
public class myClass
{
public string myFunction()
{
return "I am Here";
}
}
}
then i created a tlb file with "tlbexp" command,
then i used the "regasm" command n registered this dll on my machine.
When i created an object of type myClass on my machine using VBScript, everything is working fine... here i used the CreateObject() method as shown below:
Set myObj = CreateObject("myDll.myClass")
Now i want to create an object of type myClass from VBScript that is running on another machine, how can i do this. please help me how can i access that dll file, am using the CreateObject() function as shown below:
Set HD = CreateObject("myDll.myClass","myMachineName")
now am getting error as "permission denied".
It appears that this is supported if the assembly is built with as COM visibility enabled.
Is it possible to execute a .NET assembly(dll) from vbscript?
By the way, I was pretty delighted to find out that there is a JScript compiler for .NET which allows one to write .NET code using JScript and also to target other .NET assemblies but unfortunately I haven't found anything similar for VBScript.