Forcal extension dynamic library

zhaozj2021-02-17  48

Welcome to the main math software main station, I want to send me a message at the 6TO23 station: 9CBS Blog Baidu Space

Forcal extension dynamic library

It is very convenient to add constants, functions, or any other type of data to Forcal. In order to facilitate function and data sharing, the function and data is encapsulated into the dynamic library, adding to Forcal in the form of a dynamic library, this dynamic library is called Forcal extended dynamic library. Forcal extension dynamic library only requires an output function:

// force expands the unique output function of the dynamic library; //hfc:forcal.dll handle; binit = true: Initialization dynamic library, binit = false: Release the dynamic library. // binit = true, return value forcaldll = 0: initialization failed; forcaldll = 1: Initialization success; // binit = true, return value forcaldll = 2: Initialization success, only register some constants, the initialization is completed, then uninstall Library. When // binit = false, return value forcaldll = 0: release failed; forcaldll = 1: release success; extern "c" int _stdcall forcedll (Hinstance HFC, Bool Binit) {... if (binit) // Initialization Dynasty {. Return 1;} else // Release dynamic library {... Return 1;}}

It can be seen that although the Forcal extension dynamic library has only one output function, the function accepts the handle of the Forcal.dll loaded by the main adjustment, so any complex function can be completed. For the security of the application, INITFORCAL (initialization forcal) and FreeForcal (release forcal) are disabled in the Forcal extended dynamic library.

If another thread is launched in the dynamic library, you should pay attention to the principle of using the Forcal function in multi-threaded programs, namely, in addition to getRunerR (), TestrunerR () and setRunerr () three functions, the rest can only be single-threaded. Use (not allowed to run these functions simultaneously at the same time). To this end, it is agreed with PUSEforcal = searchkey ("Useforcal", fc_key_user); obtains a function pointer to mutually exclusive communication between multi-threaded use forcal, which can be defined in the main program or Forcal extension dynamic library, the function description is as follows:

/ / (1) iUse = 1, indicating that you want to apply for use, if the function return value useforcal = 0: Usefort = 1: Application is unsuccessful, // Other threads are using forcal, then apply for application; useforcal = -1: The application is unsuccessful, indicating that the application is to release forcal, so there is therefore prepared before exiting. // (2) iUse = 2, indicating that you want to apply for use, if other threads are using forcal, the function does not return, waiting until the application is successful. // If the function return value useforcal = 0: Application is successful; useforcal = -1: Application is unsuccessful, indicating that the application is to release forcal, and therefore should prepare before exiting. // (3) When IUSE = 0, it means that the use right to return to Forcal is meaningless. // (4) When IUSE = 3, set the activity flag, indicating that the force runs normally, and the function return value is meaningless. // (5) When IUSE = 4, the cancellation activity flag is canceled, indicating that the force runs in an uncontrollable phase, and the function return value is meaningless. // (6) When IUSE = 5, the query activity flag, useforcal = 0: runs normally; useforcal = 1: It is not normal. // Note: Forcal is extremely important and limited resource. It will be returned in time after it is used. Extern "C" INT_STDCALL UseForcal (int iUse); can set a function void _stdcall dllMessage (char *) in the Motation or any of the Forcal extension dynamic library; Then use the address of the function with INSERTKEY ("DLLMESSAGE", FC_KEY_USER, DLLMESSAGE, NULL, V) to Forcal. All Forcal extended dynamic libraries use this function to send information. Any thread can set this function as needed.

When designing Forcal extended dynamic libraries, you'll follow the principle of registration functions and data who released.

When loading and uninstalling Forcal expansion dynamic libraries, the principle of advanced will be followed, and then uninstalled.

Forcal expansion dynamic libraries can be designed with any advanced language such as C / C , Delphi, Fortran.

"Quitfc.dll", "fcconst.dll", "fcconst.dll", "fcconst.dll" in this package is designed with VC 6.0. Add a "Win32 Dynamic-Link Library" project with VC 6.0 to add the corresponding source program file, module definition file, and header file force7.h to the project.

Quitfc.dll: Used to exit an infinite loop at the force of the Forcal. Source file files and module definition files in the folder "dll_quitfc".

Fcconst.dll: Used to add constants to Forcal to add a complete amount to uninstall the library. Source program files and module definition files in the folder "DLL_FCCONST".

EXAMPLE.DLL: Several functions are registered with Forcal. Source files and module definition files in the folder "DLL_EXAMPLE".

The demo program "Project1.exe" generated by Delphi can load these three dynamic libraries. Copyright © Forcal Mathematics Software 2002-2007, All rights reserved E-mail: forcal@sina.com QQ: 630715621 Recent Update:

January 10, 2007

转载请注明原文地址:https://www.9cbs.com/read-28581.html

New Post(0)