Page 1 of 1

Using with Borland C++ Builder 5

Posted: Fri Oct 31, 2008 10:17 am
by hare
Hi,

I am trying to use the dplotlib.dll in BorlandC++.
I set the preferences as:

memset(&dplot,0,sizeof(DPlot));
dplot.Version = DPLOT_DDE_VERSION;
dplot.DataFormat = DATA_XYYY;
dplot.MaxCurves = 1;
dplot.MaxPoints = NP;
dplot.NumCurves = 2;
dplot.Scale = SCALE_LINEARX_LINEARY;
dplot.LegendX = 0.05F;
dplot.LegendY = 0.05F;
dplot.NP[0] = NP;

And commands as
sprintf(cmds,"[ManualScale(0,0,1,30)][TickInterval(1,0.5,0.25)]"
"[Caption(\"DPLOTLIB XY Test\")]"
"[GeneralOptions(0x00000020,1)]"
"[Color(1,255,0,0)][Color(2,0,0,255)]"
"[TextFont(1, 8, 0,0,0,0,0,\"Arial\")]"
"[TextFont(2,12,700,0,0,0,0,\"Arial\")]"
"[TextFont(4,10, 0,0,0,0,0,\"Arial\")]"
"[TextFont(5,10, 0,0,0,0,0,\"Arial\")]"
"[TextFont(6,10, 0,0,0,0,0,\"Arial\")]"
"[ClearEditFlag()]");

When I call dPlot_Plot8 the return value is "0" and a blank Plot gets opened and it raises exception?

Did I miss out something?

cheers, hare

Posted: Fri Oct 31, 2008 3:27 pm
by DPlotAdmin
This:
dplot.MaxCurves = 1;
dplot.MaxPoints = NP;
dplot.NumCurves = 2;
can't be right. MaxCurves must be greater than or equal to NumCurves. Also you're setting the number of points in the first curve (dplot.NP[0]=NP), but not the second (assuming there is a second curve; if there isn't then set NumCurves=1).

But... the DLL should catch all of those problems and shouldn't cause a crash. If you fix the above and still have problems then most likely the problem is in the interface, something like using _cdecl instead of _stdcall.

Either way, please let me know how this works out.

Posted: Mon Nov 03, 2008 3:26 am
by hare
thanks a lot..
it works after I set NumCurves = 1. Looks like the dll is not handling this kind of exception..

Posted: Mon Nov 03, 2008 11:44 am
by DPlotAdmin
Whoops, you're right: that isn't trapped like I thought it was. It will be in the next release.