Using with Borland C++ Builder 5

Q&A for C, C++, and/or C# developers using DPlot

Moderator: DPlotAdmin

Post Reply
hare
Posts: 2
Joined: Thu Oct 30, 2008 10:57 am

Using with Borland C++ Builder 5

Post 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
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post 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.
Visualize Your Data
support@dplot.com
hare
Posts: 2
Joined: Thu Oct 30, 2008 10:57 am

Post by hare »

thanks a lot..
it works after I set NumCurves = 1. Looks like the dll is not handling this kind of exception..
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Whoops, you're right: that isn't trapped like I thought it was. It will be in the next release.
Visualize Your Data
support@dplot.com
Post Reply