CN111399932A - Method and system for calling D LL, browser processing method and browser - Google Patents
Method and system for calling D LL, browser processing method and browser Download PDFInfo
- Publication number
- CN111399932A CN111399932A CN201811641934.8A CN201811641934A CN111399932A CN 111399932 A CN111399932 A CN 111399932A CN 201811641934 A CN201811641934 A CN 201811641934A CN 111399932 A CN111399932 A CN 111399932A
- Authority
- CN
- China
- Prior art keywords
- calling
- browser
- function
- called
- parameters
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 57
- 238000003672 processing method Methods 0.000 title claims abstract description 13
- 230000007246 mechanism Effects 0.000 claims description 17
- VYZAMTAEIAYCRO-UHFFFAOYSA-N Chromium Chemical group [Cr] VYZAMTAEIAYCRO-UHFFFAOYSA-N 0.000 claims description 8
- 238000006243 chemical reaction Methods 0.000 claims description 6
- 230000006870 function Effects 0.000 description 157
- 238000005516 engineering process Methods 0.000 description 11
- 230000008569 process Effects 0.000 description 10
- 238000012545 processing Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 7
- 230000010354 integration Effects 0.000 description 5
- 238000004590 computer program Methods 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 238000004806 packaging method and process Methods 0.000 description 2
- 241000238582 Artemia Species 0.000 description 1
- 238000009825 accumulation Methods 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 230000008275 binding mechanism Effects 0.000 description 1
- 229910052804 chromium Inorganic materials 0.000 description 1
- 239000011651 chromium Substances 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000008571 general function Effects 0.000 description 1
- 238000007429 general method Methods 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The invention relates to a method and a system for calling D LL, a browser processing method and a browser, wherein the method for calling D LL comprises the steps of obtaining calling parameters of D LL to be called, calling the D LL to be called according to the calling parameters based on a special function of a customized browser, wherein the customized browser is the browser comprising the special function, and the special function is used for calling the D LL outside the customized browser.
Description
Technical Field
The invention relates to the technical field of computer front-end application, in particular to a method and a system for calling D LL, a browser processing method and a browser.
Background
In Windows, many application programs are not a complete executable file and are divided into a plurality of relatively independent Dynamic link libraries, namely D LL files, when a certain program is executed, the corresponding D LL file is called, functions (subprocesses) of various programs are stored in the D LL file, when the program needs to call the functions, the D LL is loaded first, then the addresses of the functions are obtained, and finally the functions are called.
However, in practical application, when the browser needs to apply a certain function of other external devices, the browser needs to be re-developed, and the function of the corresponding external device is encapsulated inside the browser, for example, the function of the card reader needs to be encapsulated in the browser.
Disclosure of Invention
In view of this, a method and a system for calling D LL, a method for processing a browser, and a browser are provided to solve the problem in the related art that only a specific function is integrated in a browser, and therefore, when other functions need to be integrated in other scenes, the browser needs to be re-developed, which results in cumbersome operations.
The invention adopts the following technical scheme:
in a first aspect, an embodiment of the present invention provides a method for calling D LL, where the method for calling D LL includes:
acquiring a calling parameter of D LL to be called;
based on a special function of the customized browser, calling the D LL to be called according to the calling parameters;
wherein the customized browser is a browser including the dedicated function, and the dedicated function is used for calling D LL outside the customized browser.
Further, the obtaining of the invocation parameter of D LL to be invoked includes:
and receiving a calling parameter input in the JS framework by the developer based on an extension mechanism of the JS framework.
Further, the calling parameters comprise a D LL file name and a function name in a D LL file.
Further, the method also comprises the following steps:
and embedding the special function in an extension part of the open source browser based on an extension mechanism of a script engine of the browser.
Further, the script engine is a V8 engine, and the open source browser is a chrome.
Further, the invoking the D LL to be invoked according to the invocation parameter based on the dedicated function of the customized browser includes:
based on the dedicated function, the following is performed:
the data type of the calling parameter specified by the script engine is converted into the data type specified by D LL, and the calling parameter after the data type conversion is written into a function call stack by adopting an embedded assembly mode;
reading a calling parameter from a function calling stack by adopting an embedded assembly mode, and calling D LL according to the calling parameter;
acquiring a return value of the function by adopting an inline assembly mode, wherein the return value is used for indicating success or failure of calling;
and after the calling is successful, acquiring the parameters called by the D LL, converting the parameters into the data types specified by the script engine, and returning the data types to the user of the customized browser.
Further, the number of the D LL is one or more, and each D LL is used for recording a driving function of an external device.
In a second aspect, an embodiment of the present invention provides a system for invoking D LL, where the system for invoking D LL includes:
the front-end framework is used for acquiring calling parameters of D LL to be called;
the customized browser is used for calling the D LL to be called according to the calling parameters based on a preset special function;
wherein the customized browser is a browser including the dedicated function, and the dedicated function is used for calling D LL outside the customized browser.
In a third aspect, an embodiment of the present invention provides a method for processing a browser, where the method for processing the browser includes:
receiving a calling parameter of D LL to be called sent by a front-end framework;
based on a preset special function, calling the D LL to be called according to the calling parameters;
wherein the dedicated function is used to call D LL outside the browser.
In a fourth aspect, an embodiment of the present invention provides a browser, where the browser includes:
the receiving module is used for receiving calling parameters of D LL to be called, which are sent by the front-end framework;
the calling module is used for calling the D LL to be called according to the calling parameters based on a preset special function;
wherein the dedicated function is used to call D LL outside the browser.
According to the technical scheme, the specific functions required to be realized by the browser are determined by obtaining the calling parameters of the D LL to be called, the special functions can call the D LL outside the customized browser, namely, the functions corresponding to the D LL can be integrated by calling different D LL outside the browser, namely, the functions of corresponding external equipment are integrated, the D LL to be called is determined by combining the calling parameters based on the special functions of the customized browser, so that the browser can realize integration of different functions by calling the D LL in different application scenes without packaging different functions of the equipment outside the browser in the browser, the D LL to be called is called by calling the parameters, the integration of the external equipment of the browser can be realized, the defect that the browser in the related technology can only integrate specific functions is overcome, the capacity of the browser for integrating the corresponding functions of the external equipment of the browser is improved, and the universality of the browser is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a method for calling D LL according to an embodiment of the present invention;
FIG. 2 is a flow chart of another method for invoking D LL according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a calling process of D LL of an external device suitable for use in an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a system for calling D LL according to an embodiment of the present invention;
fig. 5 is a flowchart of a processing method of a browser according to an embodiment of the present invention;
FIG. 6 is a diagram of a browser provided by an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
First, a scenario applicable to the embodiment of the present invention is introduced, and currently, due to industrial application needs, various enterprises and public institutions all use external devices in a front-end application system, where the external devices may include a conventional printer, and emerging devices such as a password keyboard, a counter, an all-in-one card reader, and a fingerprint login device, which are widely applied in a financial system.
The device driver is a special program which can make the computer and the device communicate, and is equivalent to a hardware interface, and a computer operating system can only control the work of the hardware device through the interface, and if the driver of a certain device is not installed correctly, the device driver cannot work normally.
Each device has different manufacturers to provide different drivers and different driver calling modes, and by using the D LL calling method provided by the embodiment of the invention, when the functions of different devices are required to be integrated in front-end application, a browser does not need to be specially developed aiming at the specific functions of each device.
Example one
Fig. 1 is a flowchart of a method for invoking D LL according to an embodiment of the present invention, where the method may be executed by a system for invoking D LL according to an embodiment of the present invention, and the system may be implemented in software and/or hardware, and referring to fig. 1, the method may specifically include the following steps:
s101, obtaining calling parameters of D LL to be called.
For example, S101 is performed by the JS framework.
The JS is called JavaScript completely, is an transliteration type scripting language, is a dynamic type, weak type, prototype-based language, is provided with a built-in support type, an interpreter of the JS is called a JavaScript engine, is a part of a browser, is widely used for a scripting language of a client, is used on an HTM L (an application under a standard general markup language) webpage at the earliest time, and is used for adding a dynamic function to the HTM L webpage.
The JS framework encapsulates common methods to facilitate calling and using, one framework is a reusable design component which specifies an application system structure, and the JS framework encapsulates and abstracts various functions of the JS, so that simplicity and better compatibility are achieved during using, and the content in the framework can be expanded. JS frameworks, which can typically include ExtJS, EasyUI, angular.js, fact.js, and vue.js, provide rich components and powerful data processing capabilities in terms of interface presentation and data processing.
In Windows, many application programs are not a complete executable file and are divided into a plurality of relatively independent Dynamic link libraries, namely D LL files, when a certain program is executed, the corresponding D LL file is called, functions (subprocesses) of various programs are stored in the D LL file, when the program needs to call the functions, D LL needs to be loaded first, then the addresses of the functions are obtained, and finally the functions are called.
Specifically, the application front-end JS framework obtains calling parameters of the D LL to be called, wherein the calling parameters comprise a D LL file name and a function name in a D LL 0 file, a D LL file corresponding to a D634 2 name can be found through the D LL file name, then a function name in the D LL file is obtained, and then a corresponding function is found according to the function name.
S102, calling the D LL to be called according to the calling parameter based on a special function of the customized browser, wherein the customized browser is a browser comprising the special function, and the special function is used for calling the D LL outside the customized browser.
For example, S102 is performed by the customized browser.
Accordingly, the browser containing the special function can be called a customized browser to be distinguished from a general browser not containing the special function.
Specifically, based on the special function of the customized browser, D LL to be called is called according to calling parameters including the file name of D LL and the function name in the D LL file, in the actual application process, if a JS frame only acquires the file name of D LL, D LL to be called can be called according to the file name of D LL, if the JS frame only acquires the function name in the D LL file, the D LL file name to which the JS frame belongs is determined according to the function name, and then D LL to be called is called according to the file name of D LL.
According to the technical scheme, the specific functions required to be realized by the browser are determined by obtaining the calling parameters of the D LL to be called, the special functions can call the D LL outside the customized browser, namely, the functions corresponding to the D LL can be integrated by calling different D LL outside the browser, namely, the functions of corresponding external equipment are integrated, the D LL to be called is determined by combining the calling parameters based on the special functions of the customized browser, so that the browser can realize integration of different functions by calling the D LL in different application scenes without packaging different functions of the equipment outside the browser in the browser, the D LL to be called is called by calling the parameters, the integration of the external equipment of the browser can be realized, the defect that the browser in the related technology can only integrate specific functions is overcome, the capacity of the browser for integrating the corresponding functions of the external equipment of the browser is improved, and the universality of the browser is improved.
On the basis of the technical scheme, the method for calling the D LL further comprises the step of embedding the special function in an extension part of the open source browser based on an extension mechanism of a script engine of the browser.
Wherein, open source means that the source code of the software is public, and the open source browser means the browser which the source code is public, that is, the source code of the browser can be used by the public, and the using, modifying and issuing process is not limited by the license.
The script engine refers to an interpreter of a computer programming language, such as ASP, PHP, etc. for building a website, and its function is to interpret the program text of an executing user and translate it into machine codes that can be executed by a computer, so as to implement a series of functions. The main function of the JS engine is to parse and execute JS codes, and in general, when the diversified requirements of a user cannot be met, extension can be added to improve the capability of the JS engine.
In general, a general open source browser does not include a dedicated function, and thus, a call to the external D LL of the browser cannot be realized, a dedicated function needs to be embedded in an extension portion of the open source browser, and an embedding principle is generally an extension mechanism of a script engine based on the browser, and if the script engine is different, the corresponding extension mechanism is different.
Illustratively, the script engine is a V8 engine, and the open browser is chrome.
The V8 engine is an open source JavaScript engine, the V8 is developed by C + + and used in a Google browser, before the JavaScript is run, compared with other JavaScript engines, the JavaScript engines are converted into byte codes or interpreted and executed, the V8 compiles the JavaScript engines into native machine codes, and methods such as inline cache are used for improving the performance and the running speed of a program.
When the script engine is a V8 engine, the Extension mechanism includes binding and Extension, where the binding mechanism refers to generating a binding file using an ID L (Interface Description L instruction) file or an Interface file, compiling the binding file with a V8 engine, performing capability Extension through a base class Extension of V8, and dynamically adding functional characteristics to the engine without compiling with a V8 engine, and having great flexibility.
The open source browser in the embodiment of the invention is a Chrome, which is a web browser developed by Google, issues and opens source codes with multiple free copyrights such as BSD license and the like, is an engine behind the Chrome browser of Google, and aims to create a safe, stable and quick universal browser.
It should be noted that D LL is one or more, and in some embodiments, for example, in an external device to be integrated with a browser, each D LL is used to record a driver function of an external device, specifically, the number of D LL is not limited, D LL may be one or more, where each D LL is used to record a driver function of an external device, and the calling of the corresponding driver function of the external device is implemented by calling D LL, and in the D LL file, different functions correspond to different functions of the external device, so that the integration of functions corresponding to functions in the D LL file in the external device in the browser may be implemented.
In addition, the technical scheme in the embodiment of the invention can meet the browser compatibility problem when a front-end application interface is constructed based on HTM L5, wherein the reasons for the browser compatibility problem are roughly as follows.
Example two
Fig. 2 is a flowchart of another method called by D LL according to a second embodiment of the present invention, where this embodiment is implemented on the basis of the foregoing embodiment, referring to fig. 2, the method may specifically include the following steps:
s201, the JS framework receives the calling parameters input by the developer in the JS framework based on an extension mechanism of the JS framework.
For example, referring to fig. 3, the developer writes a call parameter in the JS framework through a JS script.
The extension mechanism of the framework is usually a mechanism for developers to effectively extend functions of one block according to the current application scenario to realize application of specific functions in a specific application scenario, and the common extension mechanism provides a plurality of extension points to realize different extension functions through different extension points.
The embodiment of the invention provides an extension mechanism of a JS framework, which is an extension mechanism combining the characteristics of JavaScript and also comprises different extension points.
In an actual application process, a developer inputs corresponding calling parameters in a JS frame according to the requirements of a current scene, wherein the current scene takes a bank service system as an example, and the requirements of the current scene are that a browser on a computer of a bank manual office window needs to realize connection with outside-cabinet clear equipment arranged outside the window and normally interacts with the outside-cabinet clear equipment to complete business of a bank counter, wherein the outside-cabinet clear equipment integrates products outside a bank cabinet such as a password keyboard evaluator and an interphone.
In the actual application process, the purpose of providing the encapsulated JS framework script by the front end is that a front end developer uses the JS script to conveniently use external equipment, and the extension content of the front end JS framework mainly comprises:
the method comprises the steps of firstly providing registration of equipment drivers to call D LL of the equipment, specifically, the registration of the driver equipment refers to the fact that various types of information of external equipment to be integrated are registered, the various types of information comprise call parameters and the like, secondly, providing a general JS function call interface, and calling parameters in projects or products according to JS function requirements, wherein the call parameters mainly comprise a D LL file type, a D LL file name, a function name in a D LL file, function parameters in a D LL file, parameter names and parameter types in each function, and the like.
S202, the JS framework sends the calling parameters to the customized browser, and the customized browser converts the data types of the calling parameters specified by the script engine into the data types specified by D LL.
Each script engine specifies the data type applicable under the current script engine, that is, the current script engine takes the V8 engine as an example, in this case, the data type specified by the script engine is the data type specified by the V8 engine, since the D LL file is written by using the inline assembly technology of the C + + language, the data type specified by D LL is usually the C + + data type in the process of the actual special function executing the D LL call.
For example, referring to fig. 3, taking the script engine as the V8 engine as an example, the V8 extension mechanism (denoted by V8 extension in fig. 3) may be used to implement the dedicated function (denoted by JS native function in fig. 3), the dedicated function is used to call D LL outside the browser, and further, referring to fig. 3, the external device driver may include a card reader driver, a password keyboard driver, an out-of-cabinet device, and the like.
For example, after the V8 engine receives the calling parameter sent by the JS framework, the data type of the calling parameter specified by the V8 engine is converted into the data type specified by the D LL.
The calling parameters comprise a D LL file name and a function name in a D LL file, exemplarily, the data type defined by the V8 engine of the calling parameters is converted into a basic C + + data type, so that the calling of the D LL is realized through the conversion of the data type.
And S203, the customized browser writes the call parameters after the data type conversion into the function call stack by adopting an embedded assembly mode.
For example, a special function in the customized browser uses an inline assembly mode to write the call parameters after the data type conversion into a function call stack.
In particular, the inline assembly means that assembly language is inserted into C language or C + + language, and the inline assembly mode has strong flexible operability, so that the output of the inline assembly mode can be displayed through C or C + + variables, and the capability enables the inline assembly mode to be used as an interface of assembly instructions and C programs or C + + programs containing the inline assembly instructions.
A stack, also known as a stack, is an arithmetic-limited linear table, which allows only insertion and deletion operations at one end of the table, called the top of the stack and the other end called the bottom of the stack, inserting a new element into a stack, called push, push or push, placing the new element on the top of the stack to make it a new top of the stack element, deleting an element from a stack, called pop or pop, deleting a top of the stack element to make its neighboring elements new top of the stack element.
In the embodiment of the present invention, according to the calling convention of D LL, an embedded assembly manner is adopted to write the call parameters converted into the basic C + + data types into the function call stack, so as to apply the call parameters in the function call stack in the function call process.
S204, the customized browser reads the calling parameters from the function call stack by adopting an embedded assembly mode, and calls D LL according to the calling parameters.
For example, a special function in the customized browser specifically uses an inline assembly mode, reads a call parameter from a function call stack, and calls D LL according to the call parameter.
Specifically, through a stacking operation, call parameters in a function call stack wait to be called out of the stack in the stack, an embedded assembly mode is adopted, the call parameters are read from the function call stack, and D LL is called according to the call parameters.
S205, the customized browser acquires a return value of the function in an embedded assembly mode, wherein the return value is used for indicating success or failure of calling.
For example, a special function in the customized browser specifically uses an inline assembly mode, reads a call parameter from a function call stack, and calls D LL according to the call parameter.
In the field of computer programming, a function name of a function is a representation of the function and is also a variable, and since a function name variable is generally used for bringing back processing result data of the function to a calling function, namely, a recursive call, the function name variable is generally called a return value, a function without a return value is only used for completing one operation, and a parameter with a return value indicates whether the function is successfully executed.
Specifically, in the calling process of the function, the return value of the function is acquired in an embedded assembly mode, wherein the success or failure of calling can be determined by analyzing the return value of the function, so that a developer is instructed to perform the next operation according to the condition of success or failure of calling.
S206, after the customized browser is successfully called, the parameters called by D LL are obtained, and are converted into the data types specified by the script engine, and then the data types are returned to the user of the customized browser.
For example, after the specific function of the customized browser is successfully called, the parameters called by D LL are obtained, and are converted into the data types specified by the script engine, and then returned to the user of the customized browser.
In a specific example, the current application scenario is money transaction in a bank counter, in this step, the parameter called by D LL may be an account number and an amount returned when an account balance is queried, and in this scenario, the user of the customized browser is a bank worker who notifies the user of the specific amount of the amount when the bank worker sees the amount.
It will be appreciated by those skilled in the art how to write specific functions to achieve the various functions described above will be apparent to those skilled in the art upon determining that the specific functions need to achieve the various functions described above.
In the embodiment of the invention, calling parameters input by a developer in a JS frame are received through an extension mechanism based on the JS frame to be stored for calling, the data type of the calling parameters specified by a script engine is required to be converted into the data type specified by D LL for calling, the calling parameters after data type conversion are written into a function calling stack in an embedded assembly mode, the calling parameters are read from the function calling stack and are called D LL according to the calling parameters, the embedded assembly mode has strong flexible operability, each calling parameter is stored in advance through stack entering operation and is called D LL according to actual requirements in combination with the calling parameters, a return value for indicating success or failure of calling is obtained to indicate a developer to perform next operation according to the return value, the parameters after D LL calling is obtained after the success of calling and is converted into the data type specified by the script engine and returned to a user of a customized browser, and the called parameters are returned to the user of the specified browser, so that the additional function called by D LL is further improved.
In addition, in the embodiment of the invention, the customized browser calls an external D LL interface in a JS script mode, particularly configures and writes a related JS script through a provided JS front-end framework, so that a D LL interface can be conveniently called to achieve a mode of quickly integrating external equipment, calls D LL by using a general method in an extension of a V8 engine of Javascript, is particularly responsible for interaction with a D LL interface in the extension, manages input and output of specific functions in a D LL file and judgment of a return result of the specific functions in a D LL file, and converts the input and output into a data type of the V8 engine, and the front end provides a special JavaScript framework, namely the front-end framework, and combines a calling parameter of D LL to be called obtained by a specific function page of the front end through a D LL file name and a function name in a D LL file, calls the specific functions in D LL by using the general functions in the front-end framework, and obtains a return value.
As another implementation manner of the embodiment of the invention, that is, another implementation manner of integrating external devices by front-end application, enterprises and products can select rich client technology according to project experience, technology accumulation and technical architecture, for example, Net and Java (using Jni technology) realize the functions of the client integrated external devices, or a rich client is adopted to package other open source browsers, for example, Webkit, D LL of the integrated external devices passes through the rich client technology, and the interface presentation still uses JS, Html and other front-end technologies.
In order to make the technical solution of the present invention easier to understand and highlight the beneficial effect of the D LL calling method in the embodiment of the present invention, the following describes an implementation means of integrating external devices with front-end applications in the related art.
In the related art, the NPAPI specification supported by the Chrome is usually applied, and the external device is integrated based on the NPAPI and other technologies, wherein the NPAPI (Netscape plug in Application Programming Interface) is a Gecko engine browser such as Netscape Navigator, Mozilla Suite, Mozilla SeaMonkey and Mozilla firefox, and an ActiveX-like plug-in Interface used by Apple Safari and Google Chrome and other webkit engine browsers. The method writes plug-ins with specific functions according to the NPAPI specification, and when the browser uses pages of the plug-ins with the specific functions, the browser calls the plug-ins, so that the browser interface and the plug-ins can interact through interfaces defined by the NPAPI specification.
Specifically, the NPAPI provides two types of interfaces, one type is implemented by a plug-in and is called by a browser, the interface provided by a related hardware manufacturer can be packaged by the external function required to be integrated by the related application, specifically, according to the method of using D LL under Windows in the prior art, the call of the specific external device is packaged in the plug-in code in a dynamic link mode during loading or a dynamic link mode during running, and the other type of interface is implemented by a browser and is called by a plug-in and mainly comprises the functions of drawing a graph, processing data stream, allocating and releasing memory.
The current way of integrating external devices based on technologies such as NPAPI and the like has the following disadvantages: the development cost is high, project implementers need to master specifications such as NPAPI and the like, then refer to interfaces of external equipment, write browser plug-ins, and finally perform joint debugging test with page developers to finish the access of the external equipment; the potential quality hazard, each writer completes the plug-in according to the NPAPI standard, the quality and the stability cannot be ensured, so that the browser has the potential instability hazard, and the quality of the project and the product is influenced; due to various problems of NPAPI specification, the Google browser gradually abandons the support of NPAPI, adopts PPAPI specification, is totally called Peer plug Application Programming Interface, is a specification developed on the basis of NPAPI, therefore, projects or products are adjusted along with the newly-proposed specification.
Compared with the related technology, in the embodiment of the invention, the calling of D LL of the external equipment outside the browser is realized by modifying the source code of the Chromium, the function of integrating the external equipment is avoided being realized through a specific plug-in specification, meanwhile, the project personnel can quickly integrate and debug the external equipment, and the construction period of the project is shortened, the method of calling the D LL interface by the JS script can enable the front-end developer to independently and quickly integrate the external equipment, and the project and the product do not need to write a complex plug-in mode to achieve the capability of integrating the external equipment;
fig. 4 is a block diagram of a D LL calling system according to an embodiment of the present invention, which is used to execute the D LL calling method according to an embodiment of the present invention, and referring to fig. 4, the system includes a front-end framework 401 and a customized browser 402.
And the front end framework 401 is used for acquiring a calling parameter of D LL to be called.
Specifically, the front end framework 401 may be a front end JS framework through which the invocation parameter of D LL to be invoked is acquired.
The customized browser 402 is used for calling the D LL to be called according to the calling parameters based on a preset special function;
wherein the customized browser is a browser including the dedicated function, and the dedicated function is used for calling D LL outside the customized browser.
Specifically, the dedicated function is preset inside the customized browser 402, and the customized browser may call D LL outside the customized browser according to the call parameter based on the preset dedicated function, where the outside of the customized browser is a part of the inside of the customized browser, and the outside of the customized browser may be an external device with a specific function, such as a password device and an out-of-cabinet device, which needs to establish a communication connection with the browser.
The D LL calling system provided by the embodiment of the invention can execute the D LL system calling method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the executing method.
Fig. 5 is a flowchart of a processing method of a browser according to an embodiment of the present invention, where the method may be executed by the browser according to the embodiment of the present invention, and the browser may be implemented in software and/or hardware. Referring to fig. 5, the method may specifically include the following steps:
s501, receiving a calling parameter of D LL to be called, which is sent by the front-end framework.
Specifically, the front-end frame receives a calling parameter input in the JS frame by a developer based on an extension mechanism of the JS frame, sends the calling parameter to the customized browser, and the customized browser receives the calling parameter of D LL to be called, which is sent by the front-end frame.
S502, calling the D LL to be called according to the calling parameters based on a preset special function, wherein the special function is used for calling the D LL outside the browser.
Specifically, the dedicated function is preset inside the customized browser, and the customized browser can call D LL outside the customized browser according to the call parameter based on the preset dedicated function, wherein the outside of the customized browser is a part of the inside of the customized browser, and the outside of the customized browser can be an external device with a specific function, such as a password device and an out-of-cabinet device, which needs to establish a communication connection with the browser.
Fig. 6 is a schematic structural diagram of a browser according to an embodiment of the present invention, where the browser is used to execute a processing method of the browser according to the embodiment of the present invention. Referring to fig. 6, the browser includes a receiving module 601 and a calling module 602.
The receiving module 601 is configured to receive a calling parameter of D LL to be called, which is sent by a front end framework;
the calling module 602 is configured to call the D LL to be called according to the calling parameter based on a preset dedicated function.
Wherein the dedicated function is used to call D LL outside the browser.
The browser provided by the embodiment of the invention can execute the processing method of the browser provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
An embodiment of the present invention further provides an electronic device, please refer to fig. 7, fig. 7 is a schematic structural diagram of the electronic device, and as shown in fig. 7, the electronic device includes: a processor 710, and a memory 720 coupled to the processor 710; the memory 720 is used for storing computer programs; the processor 710 is used for calling and executing the computer program in the memory to execute the following processing method of the browser:
a browser processing method comprises the following steps:
receiving a calling parameter of D LL to be called sent by a front-end framework;
based on a preset special function, calling the D LL to be called according to the calling parameters;
wherein the dedicated function is used to call D LL outside the browser.
The embodiment of the present invention further provides a storage medium, where the storage medium stores a computer program, and when the computer program is executed by a processor, the method implements the following steps in the processing method of the browser:
a browser processing method comprises the following steps:
receiving a calling parameter of D LL to be called sent by a front-end framework;
based on a preset special function, calling the D LL to be called according to the calling parameters;
wherein the dedicated function is used to call D LL outside the browser.
It is understood that the same or similar parts in the above embodiments may be mutually referred to, and the same or similar parts in other embodiments may be referred to for the content which is not described in detail in some embodiments.
It should be noted that the terms "first," "second," and the like in the description of the present invention are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present invention, the meaning of "a plurality" means at least two unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.
Claims (10)
1. A method of invoking D LL, comprising:
acquiring a calling parameter of D LL to be called;
based on a special function of the customized browser, calling the D LL to be called according to the calling parameters;
wherein the customized browser is a browser including the dedicated function, and the dedicated function is used for calling D LL outside the customized browser.
2. The method according to claim 1, wherein the obtaining the calling parameter of D LL to be called comprises:
and receiving a calling parameter input in the JS framework by the developer based on an extension mechanism of the JS framework.
3. The method of claim 1, wherein the call parameters include a D LL file name and a function name in a D LL file.
4. The method of claim 1, further comprising:
and embedding the special function in an extension part of the open source browser based on an extension mechanism of a script engine of the browser.
5. The method of claim 4, wherein the script engine is a V8 engine,
the open source browser is chrome.
6. The method according to claim 1, wherein the calling the D LL to be called according to the calling parameter based on the dedicated function of the customized browser comprises:
based on the dedicated function, the following is performed:
the data type of the calling parameter specified by the script engine is converted into the data type specified by D LL, and the calling parameter after the data type conversion is written into a function call stack by adopting an embedded assembly mode;
reading a calling parameter from a function calling stack by adopting an embedded assembly mode, and calling D LL according to the calling parameter;
acquiring a return value of the function by adopting an inline assembly mode, wherein the return value is used for indicating success or failure of calling;
and after the calling is successful, acquiring the parameters called by the D LL, converting the parameters into the data types specified by the script engine, and returning the data types to the user of the customized browser.
7. The method according to any one of claims 1-6, wherein said D LL is one or more, each D LL is used for recording a driving function of an external device.
8. A system for invoking D LL, comprising:
the front-end framework is used for acquiring calling parameters of D LL to be called;
the customized browser is used for calling the D LL to be called according to the calling parameters based on a preset special function;
wherein the customized browser is a browser including the dedicated function, and the dedicated function is used for calling D LL outside the customized browser.
9. A browser processing method is characterized by comprising the following steps:
receiving a calling parameter of D LL to be called sent by a front-end framework;
based on a preset special function, calling the D LL to be called according to the calling parameters;
wherein the dedicated function is used to call D LL outside the browser.
10. A browser, comprising:
the receiving module is used for receiving calling parameters of D LL to be called, which are sent by the front-end framework;
the calling module is used for calling the D LL to be called according to the calling parameters based on a preset special function;
wherein the dedicated function is used to call D LL outside the browser.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811641934.8A CN111399932A (en) | 2018-12-29 | 2018-12-29 | Method and system for calling D LL, browser processing method and browser |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811641934.8A CN111399932A (en) | 2018-12-29 | 2018-12-29 | Method and system for calling D LL, browser processing method and browser |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111399932A true CN111399932A (en) | 2020-07-10 |
Family
ID=71432052
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811641934.8A Pending CN111399932A (en) | 2018-12-29 | 2018-12-29 | Method and system for calling D LL, browser processing method and browser |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111399932A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113110890A (en) * | 2021-04-20 | 2021-07-13 | 上海华东汽车信息技术有限公司 | Dynamic link library calling method and device, computer equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102999337A (en) * | 2012-11-20 | 2013-03-27 | 上海中信信息发展股份有限公司 | Browser packaging system and method |
CN103226474A (en) * | 2013-05-10 | 2013-07-31 | 北京奇虎科技有限公司 | Method, device and system for interaction between webpage script and browser program |
CN104679489A (en) * | 2013-12-02 | 2015-06-03 | 厦门极致互动网络技术有限公司 | System and method for internally setting web browser in online game client side |
KR20160129715A (en) * | 2015-04-30 | 2016-11-09 | 주식회사 이니라인 | Interworking system and method for web browser and application program |
CN106445620A (en) * | 2016-10-20 | 2017-02-22 | 南京莱斯信息技术股份有限公司 | Method for implementing browser-supported client-side function extension component |
-
2018
- 2018-12-29 CN CN201811641934.8A patent/CN111399932A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102999337A (en) * | 2012-11-20 | 2013-03-27 | 上海中信信息发展股份有限公司 | Browser packaging system and method |
CN103226474A (en) * | 2013-05-10 | 2013-07-31 | 北京奇虎科技有限公司 | Method, device and system for interaction between webpage script and browser program |
CN104679489A (en) * | 2013-12-02 | 2015-06-03 | 厦门极致互动网络技术有限公司 | System and method for internally setting web browser in online game client side |
KR20160129715A (en) * | 2015-04-30 | 2016-11-09 | 주식회사 이니라인 | Interworking system and method for web browser and application program |
CN106445620A (en) * | 2016-10-20 | 2017-02-22 | 南京莱斯信息技术股份有限公司 | Method for implementing browser-supported client-side function extension component |
Non-Patent Citations (1)
Title |
---|
李新, 吕玲, 曾强: "构建基于DLLs的可扩展软件结构", 河北工业科技, no. 06, 30 December 2004 (2004-12-30) * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113110890A (en) * | 2021-04-20 | 2021-07-13 | 上海华东汽车信息技术有限公司 | Dynamic link library calling method and device, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110096338B (en) | Intelligent contract execution method, device, equipment and medium | |
US9785456B2 (en) | Metadata-driven dynamic specialization | |
CN108228188B (en) | View component processing method, electronic device and readable storage medium | |
US9811360B2 (en) | Dynamic determination of application server runtime classloading | |
US9678726B1 (en) | Automatic generation of plugins for development tools | |
CN111240684B (en) | Cutting method and device of JS codes, medium and electronic equipment | |
US9836290B2 (en) | Supporting dynamic behavior in statically compiled programs | |
CN110580147A (en) | application program development method and device | |
WO2015148424A1 (en) | Supporting dynamic behavior in statically compiled programs | |
CN102541731B (en) | Platform-agnostic diagnostic data collection and display | |
CN112612448A (en) | Front-end internationalized multi-page packaging method and device and computer equipment | |
CN111427782A (en) | Operation method, device, equipment and storage medium of android dynamic link library | |
CN114077430A (en) | Interface generation method and device, electronic equipment and storage medium | |
US10255276B2 (en) | Automated translation of screen images for software documentation | |
CN114253537A (en) | Form generation method and device, electronic equipment and storage medium | |
CN114048415A (en) | Form generation method and device, electronic equipment and computer readable storage medium | |
US9141352B2 (en) | Dynamically building locale objects at run-time | |
CN118259906A (en) | Multi-terminal page adaptation method, equipment and medium based on PaaS framework | |
CN106843875B (en) | The method and apparatus of cross-platform transplanting Python program | |
CN111399932A (en) | Method and system for calling D LL, browser processing method and browser | |
CN108228266A (en) | Start the method and apparatus of Fragment components under a kind of Android card cages between different plug-in units | |
CN113641594B (en) | Cross-terminal automatic testing method and related device | |
US8943476B2 (en) | System and method to in-line script dependencies | |
Puder | A code migration framework for ajax applications | |
CN114816385B (en) | Integration method, device and equipment of heterogeneous system and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |