Dear all,
Thank you very much for responding so quickly to my dll.load problem
from yesterday. It turned out that the main problem was that Borland C++
run-time library is being called and hence the run time code needs to be
statically linked into the DLL. Using the Borland C++ builder, this is
done by turning off the linker option "Use dynamic RTL".
For those out there who might want to use the Borland C++ Builder with
Splus in the near future, I am including my two source files to build
the DLL SProject.dll. They are called SProject.cpp and SProject.h. The
DLL exports a single function "arsim1". It is loaded into Splus then
with the command dll.load("SProject.dll", "arsim1").
I hope this advice will save at least one soul all the trouble that I
had....
Michael
File SProject.cpp:
//---------------------------------------------------------------------------
#include <windows.h>
#include <condefs.h>
#pragma hdrstop
#include "SProject.h"
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
return 1;
}
//---------------------------------------------------------------------------
void DLL_EXP __stdcall arsim1(double *x, long *n, double *phi) {
int i;
for (i = 1; i < *n; i++)
x[i] += *phi * x[i-1];
}
File SProject.h:
#ifndef _SPROJECT_H
#define _SPROJECT_H
#ifdef __DLL__
# define DLL_EXP __declspec(dllexport)
#else
# define DLL_EXP __declspec(dllimport)
#endif
extern "C" void DLL_EXP __stdcall arsim1(double *x, long *n, double
*phi);
#endif
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|