J
jacob ya
Hi,
I'm working on a project that requires us to call some mathematical
functions that are in a Fortran dll. I'm trying to call the function
using P/Invoke, but I keep getting a null reference exception, anyone
have any ideas? Here's my code:
[DllImport(@"TrendFit.dll", EntryPoint="TrendFit")]
public static extern int trendfit(
int lNPt,
double dblX,
double dblY,
double dblSdY,
int lNCoeff,
double dblCoeff,
double dblV,
double dblVF);
private void button1_Click(object sender, System.EventArgs e)
{
int lNPt = 30;
double dblX = 38222.5664467593;
double dblY = 19.8469260358252;
double dblSdY = 1;
int lNCoeff = 2;
double dblCoeff = 0;
double dblV = 0;
double dblVF = 0;
int result = trendfit(lNPt, dblX, dblY, dblSdY, lNCoeff, dblCoeff,
dblV, dblVF);
// result should be 0
textBox1.Text = result.ToString();
}
Many thanks.
I'm working on a project that requires us to call some mathematical
functions that are in a Fortran dll. I'm trying to call the function
using P/Invoke, but I keep getting a null reference exception, anyone
have any ideas? Here's my code:
[DllImport(@"TrendFit.dll", EntryPoint="TrendFit")]
public static extern int trendfit(
int lNPt,
double dblX,
double dblY,
double dblSdY,
int lNCoeff,
double dblCoeff,
double dblV,
double dblVF);
private void button1_Click(object sender, System.EventArgs e)
{
int lNPt = 30;
double dblX = 38222.5664467593;
double dblY = 19.8469260358252;
double dblSdY = 1;
int lNCoeff = 2;
double dblCoeff = 0;
double dblV = 0;
double dblVF = 0;
int result = trendfit(lNPt, dblX, dblY, dblSdY, lNCoeff, dblCoeff,
dblV, dblVF);
// result should be 0
textBox1.Text = result.ToString();
}
Many thanks.