Help using DPlot w/ gcc

Q&A for C, C++, and/or C# developers using DPlot
Post Reply
sseidman
Posts: 8
Joined: Wed Aug 24, 2005 12:37 pm

Help using DPlot w/ gcc

Post by sseidman »

I can compile and line the CTEST programs included with the dplotlib distribution using mingw under mingwstudio, but I keep getting the LoadLibrary for DPLOTLIB.DLL failed.

Am I missing something stupid. All the libraries seem to be found correctly, as if I get the paths wrong, the compiler lets me know

Code: Select all

#include <windows.h>
#include <stdio.h>
#include <math.h>
#include "dplot.h"
#define DPLOT_PLOT dPlot_Plot



// Step 4: the Window Procedure
int main(void)
{
DPLOT DPlot;

double tryme [500] ;
int i;
for(i=0;i<500;i++)
{
	tryme[i]=sin((double)i/200.0);
}

	
#ifdef __GNUC__
	HINSTANCE dll;
    dll=LoadLibrary("Dplotlib.a");
	//printf(dll);
    if((dll=dPlot_Init()) == NULL)
	{
		printf("LoadLibrary for DPLOTLIB.DLL failed.\n");
		exit(0);
	}
#endif

 return(0);
}
 
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Have you renamed dplotlib.dll to dplotlib.a? If so... why? And if not then this:

dll=LoadLibrary("Dplotlib.a");

is the problem.
Visualize Your Data
support@dplot.com
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

My mistake, I answered that w/o taking a close enough look. I don't know what you're trying to do with

dll=LoadLibrary("Dplotlib.a");

but it's irrelevant since you're then calling dPlot_Init.

Is dplotlib.dll in the same folder as your executable? If not please move it there and try again. If that doesn't do it... I'm not familiar with mingwstudio, but if it allows you to run the executable from within that environment, it might be necessary to set the working directory to the folder where your executable is located.
Visualize Your Data
support@dplot.com
sseidman
Posts: 8
Joined: Wed Aug 24, 2005 12:37 pm

Post by sseidman »

Thanks muchly. That did it.
Post Reply