$LIBRARY directive
Purpose: The library named as a parameter in a $LIBRARY statement will be linked to the program without the need, at link time, to specify explicitly, on the command line or in a makefile, the library.
$LIBRARY is an alias to the C compiler "#pragma lib" feature. $LIBRARY operates on the same level as #INCLUDE and will emit the appropriate library statements within the header section of the emitted C source code.
Syntax 1: $LIBRARY "c:\bcx\lib\mylib.lib" Parameters:
|
Syntax 2: $LIBRARY "mylib.lib" Parameters:
|
Syntax 3:
$LIBRARY <mylib.lib>
Parameters:
|
Example:
$LIBRARY
<shell32.lib>'-------------------------------------------------
' BrowseFolder
' Original by Jacob Navia
' Converted to BCX version by Kevin Diggins
'-------------------------------------------------
DIM
Folder$IF
BrowseDir(
"Choose a folder"
, Folder$)
THEN
"Chosen Folder: "
, Folder$ELSE
"Action Cancelled"
END
IF
FUNCTION
BrowseDir(
Title$, Result$)
'---------------------------------------
LOCAL
pMallocAS
LPMALLOCLOCAL
browseInfoAS
BROWSEINFOLOCAL
lpItemIDListAS
LPITEMIDLISTLOCAL
Rc'---------------------------------------
CONST
BIF_NEWDIALOGSTYLE=
64
'---------------------------------------
IF
S_OK <> SHGetMalloc(
&
pMalloc)
THEN
EXIT
FUNCTION
memset(
&
browseInfo,0
,SIZEOF
(
BROWSEINFO)
)
browseInfo.hwndOwner=
GetActiveWindow(
)
browseInfo.pszDisplayName=
Result$ browseInfo.lpszTitle=
Title$ browseInfo.ulFlags=
BIF_NEWDIALOGSTYLE lpItemIDList=
SHBrowseForFolder(
&
browseInfo)
IF
lpItemIDList <> NULLTHEN
Result$=
""
IF
SHGetPathFromIDList(
lpItemIDList,Result$)
THEN
IF
LEN
(
Result$)
>0
THEN
Rc=
1
END
IF
pMalloc-
>lpVtbl-
>FREE(
pMalloc,lpItemIDList)
END
IF
pMalloc-
>lpVtbl-
>Release(
pMalloc)
' BCX is amazing !
FUNCTION
=
RcEND
FUNCTION
BCX Console Sample Programs using $LIBRARY directive.
S66.bas S73.bas S92.bas S126.bas S128.bas
$NOLIBRARY directive
Purpose: The library named as a parameter with a $NOLIBRARY directive will not be linked to the program. This directive is used with the libraries that BCX loads by default when the $CPP directive or the bc.exe -c command line flag is used.
Syntax: $NOLIBRARY "LibraryName.lib" Parameters:
|