home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lpathext.zip / lpathext.INF (.txt) < prev    next >
OS/2 Help File  |  2001-12-11  |  21KB  |  760 lines

  1.  
  2. ΓòÉΓòÉΓòÉ 1. Copyright and Notices ΓòÉΓòÉΓòÉ
  3.  
  4. IBM and OS/2 are registered trademarks of International Business Machines Corp. 
  5.  
  6.  
  7. ΓòÉΓòÉΓòÉ 1.1. OS/2 LIBPATH Extension Manipulation Functions ΓòÉΓòÉΓòÉ
  8.  
  9.  
  10. COPYRIGHT AND LICENSING INFORMATION 
  11.  
  12. This suite of subroutines is freeware, distributed as is, without any warranty 
  13. of its usefulness for any purpose. You may use it freely. You may also 
  14. redistribute it, provided no charge is levied beyond the price of its 
  15. distribution medium. 
  16.  
  17. However, the author retains all intellectual property rights. 
  18. Copyright (C) David W. Noon, 2001.
  19.  
  20. OBTAINING TECHNICAL SUPPORT 
  21.  
  22. You can obtain technical support via Internet e-mail, Compuserve, or FidoNet 
  23. Netmail. My addresses are as follows. 
  24.  
  25.  Internet:      dwnoon@os2bbs.com 
  26.                 dwnoon@ntlworld.com 
  27.                 dwnoon@compuserve.com 
  28.                 dnoon@acm.org 
  29.  Compuserve:    72172,431 
  30.  FidoNet:       David Noon 2:257/609 
  31.                 David Noon 1:109/347 
  32.  
  33.  The first FidoNet mailbox and the Internet mailboxes I check almost every day. 
  34.  The second FidoNet mailbox and the Compuserve mailbox are checked once or 
  35.  twice a week. 
  36.  
  37.  Turn-around time on problems might not be spectacular, especially if I have 
  38.  other issues to handle. This is freeware and you should expect no more than 
  39.  you pay for. 
  40.  
  41.  
  42. ΓòÉΓòÉΓòÉ 2. Preparing these Functions for your Development Environment ΓòÉΓòÉΓòÉ
  43.  
  44. The subroutines and functions supplied here are offered as complete source 
  45. code. I have also included compiled libraries prepared using the EMX+GCC 
  46. compiler, release 0.96d fixpack #4. Unless you are using this same set-up, you 
  47. will need to compile these functions with your chosen C/C++ compiler. This 
  48. detail I must leave to you. 
  49.  
  50. I am assuming that you are familiar with your chosen compiler's usage of 
  51. environment variables to handle its header file and static link library 
  52. resolution. 
  53.  
  54. Once you have suitable libraries built, copy the lpathext.h file to a directory 
  55. that is in your compiler's INCLUDE directory list. For the Watcom compiler, 
  56. this will be the OS2_INCLUDE directory list. For EMX+GCC this will be the 
  57. C_INCLUDE_PATH and CPLUS_INCLUDE_PATH directory lists; a directory that occurs 
  58. in both would be the ideal location. 
  59.  
  60. You should also copy the lpathext.lib file to a directory that is in your 
  61. linker's LIB directory list. If you are using EMX+GCC you will need also to 
  62. copy lpathext.a to a directory in the LIBRARY_PATH list. 
  63.  
  64. You might also care to copy this file, lpathext.inf, to a directory that is in 
  65. your BOOKSHELF directory list. 
  66.  
  67.  
  68. ΓòÉΓòÉΓòÉ 3. The Two Extensions to LIBPATH for DLL Loading ΓòÉΓòÉΓòÉ
  69.  
  70. There are two buffer areas, each 1024 bytes in size, that are provided in each 
  71. OS/2 address space for directory lists that can be searched to resolve requests 
  72. to load DLLs. One directory list is searched before the main LIBPATH list is 
  73. searched; this is the pre-system extension. The other list is searched after 
  74. the LIBPATH list has failed to yield a matching DLL name; this is the 
  75. post-system extension. 
  76.  
  77. The purposes of these two extensions are quite straightforward: 
  78.  
  79. The pre-system extension is used when you definitely want to override any 
  80. default system library with an application-specific library. 
  81.  
  82. The post-system extension is used when you want to proved some lowest common 
  83. denominator library as a last resort, but expect the user to have installed 
  84. some like-named library with more specific functionality, typically as some 
  85. form of customization, into a LIBPATH directory. 
  86.  
  87. You should also be aware that the OS/2 loader performs a lookaside of 
  88. already-loaded modules for a matching basename before scanning LIBPATH or 
  89. either of its extensions. This means that if some other application has already 
  90. loaded a DLL with matching basename, all your attempts to direct the loading 
  91. process will be for nought. There is only one way to overcome this problem: You 
  92. must specify a fully qualified path/filename, complete with extension, to the 
  93. DosLoadModule() API instead of supplying just the basename. While this is not 
  94. the idiomatic way to load a library, it is the only way around the basename 
  95. lookaside issue. If you choose obscure basenames for your dynamic libraries 
  96. then you will usually avoid the problem. A quick scan through the x:\OS2\DLL 
  97. directory will give you a hint on what basenames to avoid; a look through 
  98. x:\MMOS2\DLL will provide you with more basenames to avoid. 
  99.  
  100. The purpose of these library routines is to remove the constraint of changing 
  101. your current working directory during execution and thereby losing the ability 
  102. to load DLLs through the "dot" entry in the LIBPATH list, as well providing the 
  103. override and fallback features of the basic extensions. 
  104.  
  105. Constraint:  These extensions only take effect after the API or library call 
  106. has been made. If you use linker fix-ups from an import library, the DLL(s) 
  107. required for those must be present in the LIBPATH (or the shell's LIBPATH 
  108. extensions) before the program starts; so these routines will provide you with 
  109. no help there. The intent of these routines is for those who use DLL technology 
  110. in the fullest sense of the adjective "dynamic", using the DosLoadModule() API 
  111. or some wrapper function. 
  112.  
  113.  
  114. ΓòÉΓòÉΓòÉ 4. The Subroutines ΓòÉΓòÉΓòÉ
  115.  
  116. These subroutines are fairly thin wrappers on the DosQueryExtLIBPATH() and 
  117. DosSetExtLIBPATH() API calls. You need to be aware that these API calls were 
  118. not added to OS/2 until version 2.11, so any code that uses these routines will 
  119. not run under OS/2 2.1 or earlier. 
  120.  
  121. You should also be aware that calling these routines will not affect in any way 
  122. the values of the surrounding shell's BEGINLIBPATH and ENDLIBPATH environment 
  123. variables. In fact, once you start using these routines you should forget all 
  124. about those environment variables, as they were always just an ugly kludge. 
  125. [That is not to say that this library is not a kludge too. It just isn't as 
  126. ugly as the environment variable approach.] 
  127.  
  128.  
  129. ΓòÉΓòÉΓòÉ 4.1. set_beginlibpath ΓòÉΓòÉΓòÉ
  130.  
  131. This subroutine sets the pre-system LIBPATH extension to the directory in which 
  132. the executable that started the address space resides. 
  133.  
  134.       Syntax 
  135.  
  136.       Parameters 
  137.  
  138.       Returned results 
  139.  
  140.       Remarks 
  141.  
  142.  
  143. ΓòÉΓòÉΓòÉ <hidden> set_beginlibpath Syntax ΓòÉΓòÉΓòÉ
  144.  
  145. unsigned long set_beginlibpath(void); 
  146.  
  147. Example of set_beginlibpath 
  148.  
  149. #include "lpathext.h"
  150.  
  151. int main(int argc, char ** argv)
  152. {
  153.         /* Add program directory to LIBPATH */
  154.         if (set_beginlibpath() != 0)
  155.         {
  156.               fputs("Unable to set LIBPATH extension.", stderr);
  157.         return EXIT_FAILURE;
  158.         }
  159.  
  160.         /* Rest of program */
  161.  
  162.   }
  163.  
  164.  
  165. ΓòÉΓòÉΓòÉ <hidden> set_beginlibpath Parameters ΓòÉΓòÉΓòÉ
  166.  
  167. This function takes no parameters. 
  168.  
  169.  
  170. ΓòÉΓòÉΓòÉ <hidden> set_beginlibpath Returned results ΓòÉΓòÉΓòÉ
  171.  
  172. This function normally returns zero. Any other value indicates an error 
  173. returned by the DosSetExtLIBPATH() API, but these should never occur. 
  174.  
  175.  
  176. ΓòÉΓòÉΓòÉ <hidden> set_beginlibpath Remarks ΓòÉΓòÉΓòÉ
  177.  
  178. If the directory path in which the main executable resides ends with a final 
  179. node of BIN (case-insensitive) then a check is made to see if there exists an 
  180. otherwise identical directory path that ends in DLL instead. If so, then this 
  181. DLL directory path is used instead for the pre-system LIBPATH extension. 
  182.  
  183. For example, if your program is H:\Site_software\bin\Program_1.exe then the 
  184. directory path is H:\Site_software\bin. If the directory path 
  185. H:\Site_software\dll exists then that is used to set the LIBPATH extension, 
  186. otherwise the H:\Site_software\bin path is used. 
  187.  
  188.  
  189. ΓòÉΓòÉΓòÉ 4.2. set_endlibpath ΓòÉΓòÉΓòÉ
  190.  
  191. This subroutine sets the post-system LIBPATH extension to the directory in 
  192. which the executable that started the address space resides. 
  193.  
  194.       Syntax 
  195.  
  196.       Parameters 
  197.  
  198.       Returned results 
  199.  
  200.       Remarks 
  201.  
  202.  
  203. ΓòÉΓòÉΓòÉ <hidden> set_endlibpath Syntax ΓòÉΓòÉΓòÉ
  204.  
  205. unsigned long set_endlibpath(void); 
  206.  
  207. Example of set_endlibpath 
  208.  
  209. #include "lpathext.h"
  210.  
  211. int main(int argc, char ** argv)
  212. {
  213.         /* Add program directory to LIBPATH */
  214.         if (set_endlibpath() != 0)
  215.         {
  216.               fputs("Unable to set LIBPATH extension.", stderr);
  217.         return EXIT_FAILURE;
  218.         }
  219.  
  220.         /* Rest of program */
  221.  
  222.   }
  223.  
  224.  
  225. ΓòÉΓòÉΓòÉ <hidden> set_endlibpath Parameters ΓòÉΓòÉΓòÉ
  226.  
  227. This function takes no parameters. 
  228.  
  229.  
  230. ΓòÉΓòÉΓòÉ <hidden> set_endlibpath Returned results ΓòÉΓòÉΓòÉ
  231.  
  232. This function normally returns zero. Any other value indicates an error 
  233. returned by the DosSetExtLIBPATH() API, but these should never occur. 
  234.  
  235.  
  236. ΓòÉΓòÉΓòÉ <hidden> set_endlibpath Remarks ΓòÉΓòÉΓòÉ
  237.  
  238. If the directory path in which the main executable resides ends with a final 
  239. node of BIN (case-insensitive) then a check is made to see if there exists an 
  240. otherwise identical directory path that ends in DLL instead. If so, then this 
  241. DLL directory path is used instead for the post-system LIBPATH extension. 
  242.  
  243. For example, if your program is H:\Site_software\bin\Program_1.exe then the 
  244. directory path is H:\Site_software\bin. If the directory path 
  245. H:\Site_software\dll exists then that is used to set the LIBPATH extension, 
  246. otherwise the H:\Site_software\bin path is used. 
  247.  
  248.  
  249. ΓòÉΓòÉΓòÉ 4.3. query_beginlibpath ΓòÉΓòÉΓòÉ
  250.  
  251. This subroutine queries the pre-system LIBPATH extension into a buffer supplied 
  252. by the caller. 
  253.  
  254.       Syntax 
  255.  
  256.       Parameters 
  257.  
  258.       Returned results 
  259.  
  260.       Remarks 
  261.  
  262.  
  263. ΓòÉΓòÉΓòÉ <hidden> query_beginlibpath Syntax ΓòÉΓòÉΓòÉ
  264.  
  265. unsigned long query_beginlibpath(char * buffer_area); 
  266.  
  267. Example of query_beginlibpath 
  268.  
  269. #include "lpathext.h"
  270.  
  271. int main(int argc, char ** argv)
  272. {
  273.         char buffer_area[1024];
  274.  
  275.         /* Retrieve current LIBPATH extension */
  276.         if (query_beginlibpath(buffer_area) != 0)
  277.         {
  278.               fputs("Unable to query LIBPATH extension.", stderr);
  279.         return EXIT_FAILURE;
  280.         }
  281.  
  282.         /* Rest of program */
  283.         puts(buffer_area);
  284.         .
  285.         .
  286.         .
  287.  
  288.   }
  289.  
  290.  
  291. ΓòÉΓòÉΓòÉ <hidden> query_beginlibpath Parameters ΓòÉΓòÉΓòÉ
  292.  
  293. There is only one parameter for this function. 
  294.  
  295.  buffer_area (char []) 
  296.                      Needs to be as large as the current pre-system LIBPATH 
  297.                      extension string, including a trailing semi-colon and a 
  298.                      trailing NUL. A length of 1024 will always be safe. 
  299.  
  300.  
  301. ΓòÉΓòÉΓòÉ <hidden> query_beginlibpath Returned results ΓòÉΓòÉΓòÉ
  302.  
  303. This function normally returns zero. Any other value indicates an error 
  304. returned by the DosQueryExtLIBPATH() API, but these should never occur. 
  305.  
  306.  
  307. ΓòÉΓòÉΓòÉ <hidden> query_beginlibpath Remarks ΓòÉΓòÉΓòÉ
  308.  
  309. For some stupid reason, the API always adds a trailing semi-colon even though 
  310. it is totally redundant. 
  311.  
  312.  
  313. ΓòÉΓòÉΓòÉ 4.4. query_endlibpath ΓòÉΓòÉΓòÉ
  314.  
  315. This subroutine queries the post-system LIBPATH extension into a buffer 
  316. supplied by the caller. 
  317.  
  318.       Syntax 
  319.  
  320.       Parameters 
  321.  
  322.       Returned results 
  323.  
  324.       Remarks 
  325.  
  326.  
  327. ΓòÉΓòÉΓòÉ <hidden> query_endlibpath Syntax ΓòÉΓòÉΓòÉ
  328.  
  329. unsigned long query_endlibpath(char * buffer_area); 
  330.  
  331. Example of query_endlibpath 
  332.  
  333. #include "lpathext.h"
  334.  
  335. int main(int argc, char ** argv)
  336. {
  337.         char buffer_area[1024];
  338.  
  339.         /* Retrieve current LIBPATH extension */
  340.         if (query_endlibpath(buffer_area) != 0)
  341.         {
  342.               fputs("Unable to query LIBPATH extension.", stderr);
  343.         return EXIT_FAILURE;
  344.         }
  345.  
  346.         /* Rest of program */
  347.         puts(buffer_area);
  348.         .
  349.         .
  350.         .
  351.  
  352.   }
  353.  
  354.  
  355. ΓòÉΓòÉΓòÉ <hidden> query_endlibpath Parameters ΓòÉΓòÉΓòÉ
  356.  
  357. There is only one parameter for this function. 
  358.  
  359.  buffer_area (char []) 
  360.                      Needs to be as large as the current post-system LIBPATH 
  361.                      extension string, including a trailing semi-colon and a 
  362.                      trailing NUL. A length of 1024 will always be safe. 
  363.  
  364.  
  365. ΓòÉΓòÉΓòÉ <hidden> query_endlibpath Returned results ΓòÉΓòÉΓòÉ
  366.  
  367. This function normally returns zero. Any other value indicates an error 
  368. returned by the DosQueryExtLIBPATH() API, but these should never occur. 
  369.  
  370.  
  371. ΓòÉΓòÉΓòÉ <hidden> query_endlibpath Remarks ΓòÉΓòÉΓòÉ
  372.  
  373. For some stupid reason, the API always adds a trailing semi-colon even though 
  374. it is totally redundant. 
  375.  
  376.  
  377. ΓòÉΓòÉΓòÉ 4.5. clear_beginlibpath ΓòÉΓòÉΓòÉ
  378.  
  379. This subroutine sets the pre-system LIBPATH extension to an empty string. 
  380.  
  381.       Syntax 
  382.  
  383.       Parameters 
  384.  
  385.       Returned results 
  386.  
  387.       Remarks 
  388.  
  389.  
  390. ΓòÉΓòÉΓòÉ <hidden> clear_beginlibpath Syntax ΓòÉΓòÉΓòÉ
  391.  
  392. unsigned long clear_beginlibpath(void); 
  393.  
  394. Example of clear_beginlibpath 
  395.  
  396. #include "lpathext.h"
  397.  
  398. int main(int argc, char ** argv)
  399. {
  400.         /* Remove LIBPATH extension */
  401.         if (clear_beginlibpath() != 0)
  402.         {
  403.               fputs("Unable to clear LIBPATH extension.", stderr);
  404.         return EXIT_FAILURE;
  405.         }
  406.  
  407.         /* Rest of program */
  408.  
  409.   }
  410.  
  411.  
  412. ΓòÉΓòÉΓòÉ <hidden> clear_beginlibpath Parameters ΓòÉΓòÉΓòÉ
  413.  
  414. This function takes no parameters. 
  415.  
  416.  
  417. ΓòÉΓòÉΓòÉ <hidden> clear_beginlibpath Returned results ΓòÉΓòÉΓòÉ
  418.  
  419. This function normally returns zero. Any other value indicates an error 
  420. returned by the DosSetExtLIBPATH() API, but these should never occur. 
  421.  
  422.  
  423. ΓòÉΓòÉΓòÉ <hidden> clear_beginlibpath Remarks ΓòÉΓòÉΓòÉ
  424.  
  425. This function removes all entries from the pre-system LIBPATH directory list. 
  426. This includes any that might have been put there by the shell from its 
  427. BEGINLIBPATH environment variable. 
  428.  
  429.  
  430. ΓòÉΓòÉΓòÉ 4.6. clear_endlibpath ΓòÉΓòÉΓòÉ
  431.  
  432. This subroutine sets the post-system LIBPATH extension to an empty string. 
  433.  
  434.       Syntax 
  435.  
  436.       Parameters 
  437.  
  438.       Returned results 
  439.  
  440.       Remarks 
  441.  
  442.  
  443. ΓòÉΓòÉΓòÉ <hidden> clear_endlibpath Syntax ΓòÉΓòÉΓòÉ
  444.  
  445. unsigned long clear_endlibpath(void); 
  446.  
  447. Example of clear_endlibpath 
  448.  
  449. #include "lpathext.h"
  450.  
  451. int main(int argc, char ** argv)
  452. {
  453.         /* Remove LIBPATH extension */
  454.         if (clear_endlibpath() != 0)
  455.         {
  456.               fputs("Unable to clear LIBPATH extension.", stderr);
  457.         return EXIT_FAILURE;
  458.         }
  459.  
  460.         /* Rest of program */
  461.  
  462.   }
  463.  
  464.  
  465. ΓòÉΓòÉΓòÉ <hidden> clear_endlibpath Parameters ΓòÉΓòÉΓòÉ
  466.  
  467. This function takes no parameters. 
  468.  
  469.  
  470. ΓòÉΓòÉΓòÉ <hidden> clear_endlibpath Returned results ΓòÉΓòÉΓòÉ
  471.  
  472. This function normally returns zero. Any other value indicates an error 
  473. returned by the DosSetExtLIBPATH() API, but these should never occur. 
  474.  
  475.  
  476. ΓòÉΓòÉΓòÉ <hidden> clear_endlibpath Remarks ΓòÉΓòÉΓòÉ
  477.  
  478. This function removes all entries from the post-system LIBPATH directory list. 
  479. This includes any that might have been put there by the shell from its 
  480. ENDLIBPATH environment variable. 
  481.  
  482.  
  483. ΓòÉΓòÉΓòÉ 4.7. append_beginlibpath ΓòÉΓòÉΓòÉ
  484.  
  485. This concatenates the supplied list of directories to end of the pre-system 
  486. LIBPATH extension. 
  487.  
  488.       Syntax 
  489.  
  490.       Parameters 
  491.  
  492.       Returned results 
  493.  
  494.       Remarks 
  495.  
  496.  
  497. ΓòÉΓòÉΓòÉ <hidden> append_beginlibpath Syntax ΓòÉΓòÉΓòÉ
  498.  
  499. unsigned long append_beginlibpath(const char * buffer_area); 
  500.  
  501. Example of append_beginlibpath 
  502.  
  503. #include "lpathext.h"
  504.  
  505. int main(int argc, char ** argv)
  506. {
  507.         APIRET rc;
  508.         HMODULE lib_handle;
  509.         char buffer_area[1024];
  510.  
  511.         strcpy(buffer_area, "X:\\ThisApp\\DLL");
  512.         /* Extend further the current LIBPATH extension */
  513.         if (append_beginlibpath(buffer_area) != 0)
  514.         {
  515.               fputs("Unable to extend LIBPATH extension.", stderr);
  516.         return EXIT_FAILURE;
  517.         }
  518.  
  519.         /* Rest of program */
  520.         rc = DosLoadModule(buffer_area, sizeof buffer_area, "DYNALIB", &lib_handle);
  521.         .
  522.         .
  523.         .
  524.  
  525.   }
  526.  
  527.  
  528. ΓòÉΓòÉΓòÉ <hidden> append_beginlibpath Parameters ΓòÉΓòÉΓòÉ
  529.  
  530. There is only one parameter for this function. 
  531.  
  532.  buffer_area (const char []) 
  533.                      The list of directories to be concatenated onto the end of 
  534.                      the current pre-system LIBPATH extension. 
  535.  
  536.  
  537. ΓòÉΓòÉΓòÉ <hidden> append_beginlibpath Returned results ΓòÉΓòÉΓòÉ
  538.  
  539. This function normally returns zero. Any other value indicates an error 
  540. returned by the DosSetExtLIBPATH() API. The most likely error values to be 
  541. returned are 8 (ERROR_NOT_ENOUGH_MEMORY) and 161 (ERROR_BAD_PATHNAME). 
  542.  
  543.  
  544. ΓòÉΓòÉΓòÉ <hidden> append_beginlibpath Remarks ΓòÉΓòÉΓòÉ
  545.  
  546. The directory names should be fully qualified and built into a string, 
  547. separated by semi-colons, just one would when coding the LIBPATH list in 
  548. CONFIG.SYS. You do not need a trailing semi-colon. 
  549.  
  550. See also the prepend_beginlibpath() function. 
  551.  
  552.  
  553. ΓòÉΓòÉΓòÉ 4.8. append_endlibpath ΓòÉΓòÉΓòÉ
  554.  
  555. This concatenates the supplied list of directories to end of the post-system 
  556. LIBPATH extension. 
  557.  
  558.       Syntax 
  559.  
  560.       Parameters 
  561.  
  562.       Returned results 
  563.  
  564.       Remarks 
  565.  
  566.  
  567. ΓòÉΓòÉΓòÉ <hidden> append_endlibpath Syntax ΓòÉΓòÉΓòÉ
  568.  
  569. unsigned long append_endlibpath(const char * buffer_area); 
  570.  
  571. Example of append_endlibpath 
  572.  
  573. #include "lpathext.h"
  574.  
  575. int main(int argc, char ** argv)
  576. {
  577.         APIRET rc;
  578.         HMODULE lib_handle;
  579.         char buffer_area[1024];
  580.  
  581.         strcpy(buffer_area, "X:\\ThisApp\\DLL");
  582.         /* Extend further the current LIBPATH extension */
  583.         if (append_endlibpath(buffer_area) != 0)
  584.         {
  585.               fputs("Unable to extend LIBPATH extension.", stderr);
  586.         return EXIT_FAILURE;
  587.         }
  588.  
  589.         /* Rest of program */
  590.         rc = DosLoadModule(buffer_area, sizeof buffer_area, "DYNALIB", &lib_handle);
  591.         .
  592.         .
  593.         .
  594.  
  595.   }
  596.  
  597.  
  598. ΓòÉΓòÉΓòÉ <hidden> append_endlibpath Parameters ΓòÉΓòÉΓòÉ
  599.  
  600. There is only one parameter for this function. 
  601.  
  602.  buffer_area (const char []) 
  603.                      The list of directories to be concatenated onto the end of 
  604.                      the current post-system LIBPATH extension. 
  605.  
  606.  
  607. ΓòÉΓòÉΓòÉ <hidden> append_endlibpath Returned results ΓòÉΓòÉΓòÉ
  608.  
  609. This function normally returns zero. Any other value indicates an error 
  610. returned by the DosSetExtLIBPATH() API. The most likely error values to be 
  611. returned are 8 (ERROR_NOT_ENOUGH_MEMORY) and 161 (ERROR_BAD_PATHNAME). 
  612.  
  613.  
  614. ΓòÉΓòÉΓòÉ <hidden> append_endlibpath Remarks ΓòÉΓòÉΓòÉ
  615.  
  616. The directory names should be fully qualified and built into a string, 
  617. separated by semi-colons, just one would when coding the LIBPATH list in 
  618. CONFIG.SYS. You do not need a trailing semi-colon. 
  619.  
  620. See also the prepend_endlibpath() function. 
  621.  
  622.  
  623. ΓòÉΓòÉΓòÉ 4.9. prepend_beginlibpath ΓòÉΓòÉΓòÉ
  624.  
  625. This concatenates the supplied list of directories to start of the pre-system 
  626. LIBPATH extension. 
  627.  
  628.       Syntax 
  629.  
  630.       Parameters 
  631.  
  632.       Returned results 
  633.  
  634.       Remarks 
  635.  
  636.  
  637. ΓòÉΓòÉΓòÉ <hidden> prepend_beginlibpath Syntax ΓòÉΓòÉΓòÉ
  638.  
  639. unsigned long prepend_beginlibpath(const char * buffer_area); 
  640.  
  641. Example of prepend_beginlibpath 
  642.  
  643. #include "lpathext.h"
  644.  
  645. int main(int argc, char ** argv)
  646. {
  647.         APIRET rc;
  648.         HMODULE lib_handle;
  649.         char buffer_area[1024];
  650.  
  651.         strcpy(buffer_area, "X:\\ThisApp\\DLL");
  652.         /* Extend further the current LIBPATH extension */
  653.         if (prepend_beginlibpath(buffer_area) != 0)
  654.         {
  655.               fputs("Unable to extend LIBPATH extension.", stderr);
  656.         return EXIT_FAILURE;
  657.         }
  658.  
  659.         /* Rest of program */
  660.         rc = DosLoadModule(buffer_area, sizeof buffer_area, "DYNALIB", &lib_handle);
  661.         .
  662.         .
  663.         .
  664.  
  665.   }
  666.  
  667.  
  668. ΓòÉΓòÉΓòÉ <hidden> prepend_beginlibpath Parameters ΓòÉΓòÉΓòÉ
  669.  
  670. There is only one parameter for this function. 
  671.  
  672.  buffer_area (const char []) 
  673.                      The list of directories to be concatenated onto the start 
  674.                      of the current pre-system LIBPATH extension. 
  675.  
  676.  
  677. ΓòÉΓòÉΓòÉ <hidden> prepend_beginlibpath Returned results ΓòÉΓòÉΓòÉ
  678.  
  679. This function normally returns zero. Any other value indicates an error 
  680. returned by the DosSetExtLIBPATH() API. The most likely error values to be 
  681. returned are 8 (ERROR_NOT_ENOUGH_MEMORY) and 161 (ERROR_BAD_PATHNAME). 
  682.  
  683.  
  684. ΓòÉΓòÉΓòÉ <hidden> prepend_beginlibpath Remarks ΓòÉΓòÉΓòÉ
  685.  
  686. The directory names should be fully qualified and built into a string, 
  687. separated by semi-colons, just one would when coding the LIBPATH list in 
  688. CONFIG.SYS. You do not need a trailing semi-colon. 
  689.  
  690. See also the apppend_beginlibpath() function. 
  691.  
  692.  
  693. ΓòÉΓòÉΓòÉ 4.10. prepend_endlibpath ΓòÉΓòÉΓòÉ
  694.  
  695. This concatenates the supplied list of directories to start of the post-system 
  696. LIBPATH extension. 
  697.  
  698.       Syntax 
  699.  
  700.       Parameters 
  701.  
  702.       Returned results 
  703.  
  704.       Remarks 
  705.  
  706.  
  707. ΓòÉΓòÉΓòÉ <hidden> prepend_endlibpath Syntax ΓòÉΓòÉΓòÉ
  708.  
  709. unsigned long prepend_endlibpath(const char * buffer_area); 
  710.  
  711. Example of prepend_endlibpath 
  712.  
  713. #include "lpathext.h"
  714.  
  715. int main(int argc, char ** argv)
  716. {
  717.         APIRET rc;
  718.         HMODULE lib_handle;
  719.         char buffer_area[1024];
  720.  
  721.         strcpy(buffer_area, "X:\\ThisApp\\DLL");
  722.         /* Extend further the current LIBPATH extension */
  723.         if (prepend_endlibpath(buffer_area) != 0)
  724.         {
  725.               fputs("Unable to extend LIBPATH extension.", stderr);
  726.         return EXIT_FAILURE;
  727.         }
  728.  
  729.         /* Rest of program */
  730.         rc = DosLoadModule(buffer_area, sizeof buffer_area, "DYNALIB", &lib_handle);
  731.         .
  732.         .
  733.         .
  734.  
  735.   }
  736.  
  737.  
  738. ΓòÉΓòÉΓòÉ <hidden> prepend_endlibpath Parameters ΓòÉΓòÉΓòÉ
  739.  
  740. There is only one parameter for this function. 
  741.  
  742.  buffer_area (const char []) 
  743.                      The list of directories to be concatenated onto the start 
  744.                      of the current post-system LIBPATH extension. 
  745.  
  746.  
  747. ΓòÉΓòÉΓòÉ <hidden> prepend_endlibpath Returned results ΓòÉΓòÉΓòÉ
  748.  
  749. This function normally returns zero. Any other value indicates an error 
  750. returned by the DosSetExtLIBPATH() API. The most likely error values to be 
  751. returned are 8 (ERROR_NOT_ENOUGH_MEMORY) and 161 (ERROR_BAD_PATHNAME). 
  752.  
  753.  
  754. ΓòÉΓòÉΓòÉ <hidden> prepend_endlibpath Remarks ΓòÉΓòÉΓòÉ
  755.  
  756. The directory names should be fully qualified and built into a string, 
  757. separated by semi-colons, just one would when coding the LIBPATH list in 
  758. CONFIG.SYS. You do not need a trailing semi-colon. 
  759.  
  760. See also the append_endlibpath() function.