NO

Author Topic: Debugger and various errors  (Read 2790 times)

Captain Mephisto

  • Guest
Debugger and various errors
« on: February 17, 2011, 08:05:15 am »
I have a c DLL that I am trying to port to Windows Mobile, or whatever you want to call it. I compiled it and ran it with my main program and it crashed. I then created a simple main program and called the routine that caused the crash. Some of the values passed to it have been trashed. I then stripped out most of the stuff from the DLL and tried again and got the same sort of nonsense. I then created a dummy routine with the same parameters being passed in and it worked fine. I then moved the body of the function into my new one and it was back to jumbling up things. And now the details:

double stable[454];
double ugdose[454];
double secdev[454];
long numbs;

stable, ugdose and numbs are all  initialized.

In the main program I do: res = initial();
In Initial:
yp1 = (some calculated value); It is good.
ypn = (some calculated value); also good
spline_(numbs, stable, ugdose, yp1, ypn, secdev);

int spline_(long n,  double x[], double y[], double yp1, double ypn, double y2[])

Oddly enough, the debugger first says n is nonsense, then a line or two later it has the correct value. The crash occurs when trying to use ypn. The value, according to the debugger, is good but it crashes when I do "ypn > 9.9e29"
I messed with the number of paramers and the compile options and got it so that I get a fatal compiler error on the function definition line. I assume that this has something to do with the other error but I haven't a clue: "error #3110: [asm] Integer value too large for 12 bits"

For further information, I also did "int spline_(long n,  double *x, double *y, double yp1, double ypn, double *y2)" in case someone wants to tell me I should do it that way. The results are the same, neither works.

I can skip the function pass through stuff and use global variables and that works fine. But this adds complications and there are other functions that would be more difficult to change over to such an arrangement so I would like to get an answer for this behavior.
I will send code if you want. It is pretty messy right now since it was run through a fortran to c converter.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 1757
Re: Debugger and various errors
« Reply #1 on: February 18, 2011, 02:57:37 pm »
First of all check that you removed all optimizations (set optimization to "none") to correctly debug (sometimes variables are moved through registers or created on the fly to optimize and the debugger cannot locate them).
Check that the compiler setting are the same for main program and dll modules.
Then try to simplify your code to the minimal lenght that reproduce the error and then post it.