No overload for method 'PassStructIn' takes 4 arguments
-
And in my usual fashion of cobbling together source codes before I have grasped the concepts, I give you this glorious error:
No overload for method 'PassStructIn' takes 4 arguments
The code in question happens to be a call to an unmanaged dll:
class Program
{
public struct Quaternion
{
double w; double x; double y; double z;
}\[DllImport("YLScsDrawing.dll")\] public static extern void PassStructIn(ref Quaternion myQuaternion); static void Main(string\[\] args) { Program.Quaternion myQuaternion; Program.PassStructIn(ref myQuaternion); //Yada Yada Yada //Then the threading of said function... // Abs threads Thread absoluteThread = new Thread(unused => Program.PassStructIn((double)absW, (double)absX, (double)absY, (double)absZ)); absoluteThread.Start(); // Abs threads
Please advise on how to fix this... Thanks.
-
And in my usual fashion of cobbling together source codes before I have grasped the concepts, I give you this glorious error:
No overload for method 'PassStructIn' takes 4 arguments
The code in question happens to be a call to an unmanaged dll:
class Program
{
public struct Quaternion
{
double w; double x; double y; double z;
}\[DllImport("YLScsDrawing.dll")\] public static extern void PassStructIn(ref Quaternion myQuaternion); static void Main(string\[\] args) { Program.Quaternion myQuaternion; Program.PassStructIn(ref myQuaternion); //Yada Yada Yada //Then the threading of said function... // Abs threads Thread absoluteThread = new Thread(unused => Program.PassStructIn((double)absW, (double)absX, (double)absY, (double)absZ)); absoluteThread.Start(); // Abs threads
Please advise on how to fix this... Thanks.
You'd need to know how many arguments are expected. The code complains that there is no method accepting four arguments. I'd also advise against using a lambda to start a thread.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)
-
And in my usual fashion of cobbling together source codes before I have grasped the concepts, I give you this glorious error:
No overload for method 'PassStructIn' takes 4 arguments
The code in question happens to be a call to an unmanaged dll:
class Program
{
public struct Quaternion
{
double w; double x; double y; double z;
}\[DllImport("YLScsDrawing.dll")\] public static extern void PassStructIn(ref Quaternion myQuaternion); static void Main(string\[\] args) { Program.Quaternion myQuaternion; Program.PassStructIn(ref myQuaternion); //Yada Yada Yada //Then the threading of said function... // Abs threads Thread absoluteThread = new Thread(unused => Program.PassStructIn((double)absW, (double)absX, (double)absY, (double)absZ)); absoluteThread.Start(); // Abs threads
Please advise on how to fix this... Thanks.
You define PassStructIn as taking a single parameter: a reference to a structure you defined above. Then you try to call it by passing four parameters...and you are surprised you get an error? Create an instance of the struct and fill in it's fields. Then pass the ref struct to the external method.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
You define PassStructIn as taking a single parameter: a reference to a structure you defined above. Then you try to call it by passing four parameters...and you are surprised you get an error? Create an instance of the struct and fill in it's fields. Then pass the ref struct to the external method.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
Perhaps showing the code for the dll will help...
using System;
using System.Collections.Generic;
using System.Text;namespace YLScsDrawing.Drawing3d
{
public struct Quaternion
{
public double X, Y, Z, W;public Quaternion(double w, double x, double y, double z)// This is the set of parameters I wish to call... { W = w; X = x; Y = y; Z = z; } }
}
Any suggestions?
-
Perhaps showing the code for the dll will help...
using System;
using System.Collections.Generic;
using System.Text;namespace YLScsDrawing.Drawing3d
{
public struct Quaternion
{
public double X, Y, Z, W;public Quaternion(double w, double x, double y, double z)// This is the set of parameters I wish to call... { W = w; X = x; Y = y; Z = z; } }
}
Any suggestions?
Well... you could always try:
Quaternion quat = new Quaternion ((double)absW, (double)absX, (double)absY, (double)absZ));
Thread absoluteThread = new Thread(unused => Program.PassStructIn(ref quat);Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
Well... you could always try:
Quaternion quat = new Quaternion ((double)absW, (double)absX, (double)absY, (double)absZ));
Thread absoluteThread = new Thread(unused => Program.PassStructIn(ref quat);Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
The line of code...
Quaternion quat = new Quaternion ((double)absW, (double)absX, (double)absY, (double)absZ);
Brings up the following error.
'Siren.Program.Quaternion' does not contain a constructor that takes 4 arguments
Any other ideas?
-
The line of code...
Quaternion quat = new Quaternion ((double)absW, (double)absX, (double)absY, (double)absZ);
Brings up the following error.
'Siren.Program.Quaternion' does not contain a constructor that takes 4 arguments
Any other ideas?
According to your code sample it does:
public struct Quaternion
{
public double X, Y, Z, W;public Quaternion(double w, double x, double y, double z)// This is the set of parameters I wish to call... { W = w; X = x; Y = y; Z = z; }
}
If that is in a separate DLL, then I'd suggest that you check you are referencing the latest version, and that it compiles without errors. Because your code samples are referring to different struct names:
Siren.Program.Quaternion
in the error message instead of the code sampleYLScsDrawing.Drawing3d.Quaternion
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...