LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error 1172 when calling c# .NET assembly from LV, unlike Visual C#

Hi there,

 

I've build a C# assembly (Version 3.5) under Visual C# 2010 Express which works well with a test project under VC# 2010,

but crashes (see attachment) when called with the same parameters from LV 8.6. 

 

The application uses MathNet.

 

What do I have to change ?

 

Best regards,

Ted

0 Kudos
Message 1 of 5
(3,188 Views)

Are you making any private calls inside the DLL? It seems that you are using System.Reflection in your C# code, and this error is more related to the DLL parameters being passed or its execution.

 

Post the DLL details if possible.

-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
0 Kudos
Message 2 of 5
(3,183 Views)

Hi Fragger Fox,

 

this is the entire using-section of the assembly:

 

using System;

using System.Collections;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using MathNet.Numerics.LinearAlgebra.Single;

using System.Numerics;

 

The C# test class has the following directives:

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Windows.Forms;

using NearestNeighbour; //assembly above

 

Best regards,

Ted

0 Kudos
Message 3 of 5
(3,178 Views)

Ted,

Have you checked with the parameters you are passing to the DLL? When using CLFN, you have number of options to pass data, some of them are:

Instance Data Pointer

ActiveX

Adapt to type etc

 

Also, you need to check the way you "pass" the data, it can be "by value" or "pointer to value"

 

Also, check for calling conventions, it should be "C" in this case

 

(Just for your information, LV2010 doesn't automatically correct the calling convention, so this might cause a problem if calling convention is not correct

LV8.6 however doesn't have this problem)

-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
0 Kudos
Message 4 of 5
(3,170 Views)

Dear Fragger Fox,

 

I'm creating assemblies rather than dlls in C#. The assemblies are called through the .NET property nodes,

so the calling convention is dictated by the C# code, not by LV.

 

The mechanism of calling assemblies from LV _in_ _general_ works fine!

The problem only comes when the assembly itself calls functions from

 

MathNet.Numerics.LinearAlgebra.Single

 

and only if the assembly if called from LV (Version 8.6). MathNet is an opensource library not shipped with Visual C# 2010 Express. In can be found here:

 

www.mathdotnet.com

 

 

So the problem is to correctly including the responsible MathNet assemblies and/or mscorlibs and/or other (right version, right place). This is I think the place where to look at.

 

Best regards,

Ted

0 Kudos
Message 5 of 5
(3,167 Views)