Page 1 of 1

Help using DPlot w/ gcc

Posted: Wed Aug 24, 2005 12:41 pm
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);
}
 

Posted: Wed Aug 24, 2005 3:16 pm
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.

Posted: Wed Aug 24, 2005 3:24 pm
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.

Posted: Wed Aug 24, 2005 6:37 pm
by sseidman
Thanks muchly. That did it.