{{fbdoc item="title" value="DYLIBSYMBOL"}}----
Returns the address of a function or variable in a dll

{{fbdoc item="syntax"}}##
	[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Dylibsymbol** ( [[KeyPgByval|byval]] //libhandle// [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|ptr]], [[KeyPgByref|byref]] //symbol// [[KeyPgAs|as]] [[KeyPgString|string]] ) [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|ptr]]
	[[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Dylibsymbol** ( [[KeyPgByval|byval]] //libhandle// [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|ptr]], [[KeyPgByval|byval]] //symbol// [[KeyPgAs|as]] [[KeyPgShort|short]] ) [[KeyPgAs|as]] [[KeyPgAny|any]] [[KeyPgPtr|ptr]]
##
{{fbdoc item="usage"}}##
	//result// = **Dylibsymbol** ( //libhandle//, //symbol// )
##
{{fbdoc item="param"}}
	##//libhandle//##
		The [[KeyPgAny|any]] [[KeyPgPtr|ptr]] handle of a DLL returned by ##[[KeyPgDylibload|Dylibload]]##
	##//symbol//##
		A [[KeyPgString|string]] containing name of the function, or variable in the library to return the address of.  In Windows only, can also be a ##[[KeyPgShort|short]]## containing the ordinal of the function/variable.

{{fbdoc item="ret"}}
	A ##[[KeyPgPtr|pointer]]## to the function or variable in the library.
	
	If the function fails, the return value is 0.

{{fbdoc item="desc"}}
	##**Dylibsymbol**## returns a pointer to the variable or function named ##//symbol//## , in the dll pointed by ##//libhandle//##. ##//libhandle//## is obtained by loading the dll with ##[[KeyPgDylibload|Dylibload]]##. The symbol must have been ##[[KeyPgExport|Export]]##ed in the dll.
	If ##//libhandle//## is 0, the symbol is searched in the current executable or dll.
	
	If using ##[[KeyPgCdecl|Cdecl]]## functions, only the name of the procedure needs to be specified. If dynamically linking to a function created using STDCALL (default in windows), then the function must be decorated. To decorate a function, use its name, '@', then the number of bytes passed as arguments. For instance if the function ##FOO## takes 3 integer arguments, the decorated function would be 'FOO@12'. Remember, without an explicit ##[[KeyPgAlias|alias]]##, the procedure name will be uppercase.
	
	If linking to a dll created in Visual C""++""(tm), decoration need not be used. For GCC, decoration is needed.
	
	**Note:** The dylibsymbol, if failing, will attempt to automatically decorate the procedure, from @0 to @256, in 4 byte increments.

{{fbdoc item="ex"}}
	See the dynamic loading example on the [[ProPgSharedLibraries|Shared Libraries]] page.

{{fbdoc item="target"}}
	- Dynamic link libraries are not available in DOS ,as the OS doesn't support them.
	- Ordinals are not supported on Linux, 0 is always returned.
	- Windows does not support ##**Dylibsymbol**## use with variables (only with procedures).

{{fbdoc item="lang"}}
	- Not available in the //[[CompilerOptlang|-lang qb]]// dialect unless referenced with the alias ##**""__Dylibsymbol""**##.

{{fbdoc item="diff"}}
	- New to ""FreeBASIC""

{{fbdoc item="see"}}
	- ##[[KeyPgDylibload|Dylibload]]##
	- ##[[KeyPgExport|Export]]##

{{fbdoc item="back" value="CatPgModularizing|Modularizing"}}