Re: help to make dll file
Code:
double MyFunc (int nFunc, double fparam)
{
double fRetVal = 0.0;
switch (nFunc)
{
case 1:
fRetVal = sin(2.4);
break;
case 2:
fRetVal = sin(2.4);
break;
}
return fRetVal;
}
Is one way...
Viggy
Re: help to make dll file
This way doesn work. I try it.
I have example for one function from Lingo manual (i.e. sqroot):
// routines for the DLL.
//#include "stdafx.h"
#include "sqroot.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////
// CSqrootApp
BEGIN_MESSAGE_MAP(CSqrootApp, CWinApp)
//{{AFX_MSG_MAP(CSqrootApp)
//NOTE-the ClassWizard will add and
// remove mapping macros here.
// DO NOT EDIT what you see in these
// blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
CSqrootApp::CSqrootApp()
{
// The constructor
// Remove next line for a "quiet" version
// of MyUser.DLL
AfxMessageBox("@USER DLL installed");
}
CSqrootApp theApp;
#include <math.h>
extern "C" __declspec(dllexport)
void MyUser(int* pnNumberOfArgs,
double* pdArgs, double* dResult)
{
// This is an @USER routine callable by LINGO. In
// this particular case we simply take the
// square root of the first argument.
*dResult = sqrt(*pdArgs);
}
I contact them and they said that it is possible to use multiple functions with @USER by writing and compiling each function as a separate subroutine and taking an argument to @USER as the index number of the subroutine that you want to branch to.
Is there any chanse to see an example of how to do that, or explanation how to do that, because I am new in VC++.
Thanks
Re: help to make dll file
I tried And I have no luck. They said that it is possible to use multiple functions with @USER by writing and compiling each function as a
separate subroutine and taking an argument to @USER as the index number of the subroutine that you
want to branch to.
I am interested how to do that.
Thanks in advance.
Re: help to make dll file
MrViggy already posted how.
Do you encounter any problems while compiling your dll?