1 / 13

Using EXTERN

Using EXTERN. Dave Doulton. Contents. What are EXTERN functions? How do you use them? How do you create them? Examples of usage. What are EXTERN Functions?. EXTERN and EXTERNS are two functions held in the extern.dll (Dynamically Linked Library).

curry
Download Presentation

Using EXTERN

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Using EXTERN Dave Doulton Information Systems Services

  2. Contents • What are EXTERN functions? • How do you use them? • How do you create them? • Examples of usage. Information Systems Services

  3. What are EXTERN Functions? • EXTERN and EXTERNS are two functions held in the extern.dll (Dynamically Linked Library). • These functions can do anything you wish provided you can create the dll. • Your dll is placed in the SIR directory in place of the supplied version. • Note they can both take string or numeric parameters which can do different things but only return a numeric from EXTERN and a string from EXTERNS Information Systems Services

  4. How do you use them? • EXTERN • num = EXTERN ( X ) • Invokes a user-supplied external function from the EXTERN dll. • The function can take a numeric or string parameter and calls a different user function for each case. • The extern.dll library supplied by SIR contains dummy functions which return zero. • EXTERNS • str = EXTERNS ( X ) • Invokes a user-supplied external function from the EXTERN dll. • The function can take a numeric or string parameter and calls a different user function for each case. • The extern.dll library supplied by SIR contains dummy functions which return blank (a zero length string). Information Systems Services

  5. How do you create them? • To create the functions you can used the supplied template which can be found in the api/examples subdirectory of the directory where SIR is installed. Information Systems Services

  6. How do you create them? • // • // Skeleton of user defined EXTERN function. • // • // Use this to build your own extern.dll to use the PQL EXTERN and EXTERNS functions. • // See the examples in the API directory. • // • #ifndef __StdCall • #ifdef _WIN32 • #define __StdCall __stdcall • #else • #define __StdCall • #endif • #endif • // • // The sirdbms executable links to these functions as defined: • // • const char * __StdCall SIRExtern1 (char * buffer); • double __StdCall SIRExtern2 (char * buffer); • const char * __StdCall SIRExtern3 (double num); • double __StdCall SIRExtern4 (double num); Information Systems Services

  7. How do you create them? • // • // PQL Function str=EXTERNS(string) • // • const char * __StdCall SIRExtern1 (char * buffer) { • return ""; • } • // • // PQL Function num=EXTERN(string) • // • double __StdCall SIRExtern2 (char * buffer) { • return 0; • } • // • // PQL Function str=EXTERNS(num) • // • const char * __StdCall SIRExtern3 (double num) { • return ""; • } • // • // PQL Function num=EXTERN(num) • // • double __StdCall SIRExtern4 (double num) { • return 0; • } Information Systems Services

  8. Examples of usage • David Baxter has made a dll that reads web pages. • Note not all web pages can be read. It is a matter of trial and error to check if the pages you want are readable. • The web addresses are entered without the http:// in the version I am using and that will be available on the SUG website. Information Systems Services

  9. Examples of usage • I have 5 example programs • Writing the contents of a web page to a file. • Reading Share prices from the msn money website. • Reading Weather information from the BBC weather website. • Reading Train Live Running from the National rail website. • Reading Formula 1 results from F1 web pages Information Systems Services

  10. Examples of usage • The descriptions of the extern functionality in this dll are as follows: • num=EXTERN(string) • It takes a url filename and returns a socket id. It’s quick and dirty and just goes to port 80 • str=EXTERNS(num) • Num is the socket id from before and it returns a single character at a time from the http server. • num=EXTERN(num) • Num is the socket id from before and cleans up. Information Systems Services

  11. Examples of usage • The example programs use a subprocedure to read from the web server up to the next >. • This usually results in fairly small chunks of text to analyse. • The lines are searched for predetermined text that allows the extraction of the required data. Information Systems Services

  12. Examples of usage • See the example programs. Information Systems Services

  13. Any Questions? Information Systems Services

More Related