FormulaParserLib start page


FormulaParserLib usage in C/C++

FormulaParserLib.dll is a library with 5 exported functions:

Function name No.
FormulaParserLib_SetFormula 1
FormulaParserLib_IsValid 2
FormulaParserLib_Parse 3
FormulaParserLib_GetStatementNumber 4
FormulaParserLib_GetStatement 5

Description of functions see here: FormulaParserLib function reference

You may call the functions from your C/C++ program in two ways:
1. Run-time dynamic linking:
- Load "FormulaParserLib.dll" using LoadLibrary Windows API function.
- Get function address by name or number using GetProcAddress Windows API function
- Call the function.

For example:
typedef BOOL (__stdcall* funct_1)(char* formula);
typedef BOOL (__stdcall* funct_2)();
typedef BOOL (__stdcall* funct_3)(long* num);
typedef BOOL (__stdcall* funct_4)(long num,char* arg1,char* arg2,char* oper,char* funct,char* res);

funct_1	SetFormula;
funct_1 IsValid;
funct_2	Parse;
funct_3	GetStatementNumber;
funct_4 GetStatement;

HMODULE hFormulaParser;

// Somewhere in creation
if(!(hFormulaParser=LoadLibrary("FormulaParserLib.dll")))
	return;
SetFormula=(funct_1)GetProcAddress(hFormulaParser,"FormulaParserLib_SetFormula");
IsValid=(funct_1)GetProcAddress(hFormulaParser,"FormulaParserLib_IsValid");
Parse=(funct_2)GetProcAddress(hFormulaParser,"FormulaParserLib_Parse");
GetStatementNumber=(funct_3)GetProcAddress(hFormulaParser,"FormulaParserLib_GetStatementNumber");
GetStatement=(funct_4)GetProcAddress(hFormulaParser,"FormulaParserLib_GetStatement");

//somewhere in destruction
if(hFormulaParser)
	FreeLibrary(hFormulaParser);

//Use the functions:
if(!SetFormula(f_str.GetBuffer(1000)))
{
	out_file.WriteString("Cannot set formula\r\n\r\n");
	continue;
}
if(!IsValid(NULL))
{
	out_file.WriteString("Formula is invalid\r\n\r\n");
	continue;
}
		
See VCTest_runtime project source code

2. Load-time dynamicLinking:
- Add "FormulaParserLib.lib" to the Link settings of your project. You must build your project with the file
- Include "FormulaParserLib.h" header file in your implementation files where you are using functions from the library.
See VCTest_loadtime project source code

FormulaParserLib usage in VisualBasic


www.maxdz.com
Rambler's Top100