Revision history for KeyPgExternBlock


Revision [23151]

Last edited on 2019-09-02 07:33:36 by JeffMarshall [add extern "rtlib"]
Additions:
**Extern { """C""" | """C++""" | """Windows""" | """Windows-MS""" | """rtlib""" }** [ **[[KeyPgLib|Lib]]** "//libname//" ]
##**Extern """rtlib"""**## blocks combine the name decoration of ##**Extern """c"""**## and the default calling convention of fbc. When used in a namespace, the symbol respects the scope of the namespace, however, the name decoration (name mangling) links the symbol to a regular C library. This behaviour may be desired when declaring procedures that exist in the fb run-time library; where calling convention is based on the target, but we would like to have the compile time name respect the namespace.
Deletions:
**Extern { """C""" | """C++""" | """Windows""" | """Windows-MS""" }** [ **[[KeyPgLib|Lib]]** "//libname//" ]


Revision [20922]

Edited on 2016-03-13 00:44:44 by fxm [Formatting]

No Differences

Revision [20235]

Edited on 2016-02-10 16:00:16 by DkLwikki [Update link format]
Additions:
**Extern { """C""" | """C++""" | """Windows""" | """Windows-MS""" }** [ **[[KeyPgLib|Lib]]** "//libname//" ]
##**Extern """C"""**## blocks provide a default ##[[KeyPgCdecl|cdecl]]## calling convention to procedures, and also preserve the case of all names declared within them. The same effect can be achieved without the EXTERN block by using ##[[KeyPgCdecl|cdecl]]## together with an ##[[KeyPgAlias|alias]]## string containing the exact procedure name.
##**Extern """Windows"""**## blocks provide a default ##[[KeyPgStdcall|Stdcall]]## calling convention to procedures, preserve the case of all names declared within them, and on the Windows platform, append an ##"@//N//"## suffix to procedure names, where ##//N//## is the total size in bytes of any procedure parameters. Similar to the ##**Extern """C"""**## block, the same effect can be achieved by using ##[[KeyPgStdcall|stdcall]]## and ##[[KeyPgAlias|alias]]##.
##[[KeyPgLib|Lib]] "//libname//"## can be used to specify a library which will be linked in as if ##[[KeyPgInclib|#inclib "libname"]]## or ##[[CompilerOptl|-l libname]]## had been used. Additionally, all procedure declarations inside the **Extern** block will use the specified ##[[KeyPgLib|Lib]] "//libname//"## as if it was specified as part of their declarations (but it can still be overridden with an explicit ##[[KeyPgLib|Lib]] "//libname//"##).
- ##**Extern**## blocks are only available in the //[[CompilerOptlang|-lang fb]]// dialect.
- ##[[KeyPgCdecl|Cdecl]]##
- ##[[KeyPgStdcall|Stdcall]]##
- ##[[KeyPgExtern|Extern]]##
Deletions:
**Extern { """C""" | """C++""" | """Windows""" | """Windows-MS""" }** [ **[[KeyPgLib Lib]]** "//libname//" ]
##**Extern """C"""**## blocks provide a default ##[[KeyPgCdecl cdecl]]## calling convention to procedures, and also preserve the case of all names declared within them. The same effect can be achieved without the EXTERN block by using ##[[KeyPgCdecl cdecl]]## together with an ##[[KeyPgAlias alias]]## string containing the exact procedure name.
##**Extern """Windows"""**## blocks provide a default ##[[KeyPgStdcall Stdcall]]## calling convention to procedures, preserve the case of all names declared within them, and on the Windows platform, append an ##"@//N//"## suffix to procedure names, where ##//N//## is the total size in bytes of any procedure parameters. Similar to the ##**Extern """C"""**## block, the same effect can be achieved by using ##[[KeyPgStdcall stdcall]]## and ##[[KeyPgAlias alias]]##.
##[[KeyPgLib Lib]] "//libname//"## can be used to specify a library which will be linked in as if ##[[KeyPgInclib #inclib "libname"]]## or ##[[CompilerOptl -l libname]]## had been used. Additionally, all procedure declarations inside the **Extern** block will use the specified ##[[KeyPgLib Lib]] "//libname//"## as if it was specified as part of their declarations (but it can still be overridden with an explicit ##[[KeyPgLib Lib]] "//libname//"##).
- ##**Extern**## blocks are only available in the //[[CompilerOptlang -lang fb]]// dialect.
- ##[[KeyPgCdecl Cdecl]]##
- ##[[KeyPgStdcall Stdcall]]##
- ##[[KeyPgExtern Extern]]##


Revision [16865]

Edited on 2013-06-22 17:23:51 by DkLwikki [Fix & extend example]
Additions:
'' This procedure uses the default calling convention for the system, which is
'' STDCALL on Win32 and CDECL on Linux/DOS/*BSD, and is seen externally as
'' "MYTEST1@4" on Win32 and "MYTEST1" on Linux/DOS/*BSD (following FB's default
'' ALL-UPPER-CASE name mangling).
Sub MyTest1 ( ByVal i As Integer )
End Sub
Extern "C"
'' as "MyTest2".
Sub MyTest2 ( ByVal i As Integer )
End Sub
Extern "C++"
'' compatible to g++-4.x, specifically: "_Z7MyTest3i"
Sub MyTest3 ( ByVal i As Integer )
End Sub
Extern "Windows"
'' as "MyTest4@4" on Windows, and "MyTest4" on Linux, *BSD and DOS.
Sub MyTest4 ( ByVal i As Integer )
End Sub
Extern "Windows-MS"
'' as "MyTest5".
Sub MyTest5 ( ByVal i As Integer )
End Sub
MyTest1( 0 )
MyTest2( 0 )
MyTest3( 0 )
MyTest4( 0 )
Deletions:
extern "C"
'' as "SomeProcedure".
declare sub SomeProcedure ( byval as integer )
end extern
extern "C++"
'' compatible to that of g++-4.x.
declare function AnotherProcedure ( byval as integer ) as integer
extern "Windows"
'' as "YetAnotherProcedure@4" on Windows, and
'' "YetAnotherProcedure" on Linux, *BSD and DOS.
declare function YetAnotherProcedure ( byval as integer ) as integer
end extern
extern "Windows-MS"
'' as "YetAnotherProcedure".
declare function YetAnotherProcedure ( byval as integer ) as integer
end extern


Revision [15078]

Edited on 2011-04-15 12:37:25 by DkLwikki [correction: @N stdcall suffix isn't added on DOS]
Additions:
##**Extern """Windows"""**## blocks provide a default ##[[KeyPgStdcall Stdcall]]## calling convention to procedures, preserve the case of all names declared within them, and on the Windows platform, append an ##"@//N//"## suffix to procedure names, where ##//N//## is the total size in bytes of any procedure parameters. Similar to the ##**Extern """C"""**## block, the same effect can be achieved by using ##[[KeyPgStdcall stdcall]]## and ##[[KeyPgAlias alias]]##.
Deletions:
##**Extern """Windows"""**## blocks provide a default ##[[KeyPgStdcall Stdcall]]## calling convention to procedures, preserve the case of all names declared within them, and on the Windows platform, append a ##"@//N//"## suffix to procedure names, where ##//N//## is the total size in bytes of any procedure parameters. Similar to the ##**Extern """C"""**## block, the same effect can be achieved by using ##[[KeyPgStdcall stdcall]]## and ##[[KeyPgAlias alias]]##.


Revision [15077]

Edited on 2011-04-15 12:36:49 by DkLwikki [correction: @N stdcall suffix isn't added on DOS]
Additions:
##**Extern """C"""**## blocks provide a default ##[[KeyPgCdecl cdecl]]## calling convention to procedures, and also preserve the case of all names declared within them. The same effect can be achieved without the EXTERN block by using ##[[KeyPgCdecl cdecl]]## together with an ##[[KeyPgAlias alias]]## string containing the exact procedure name.
##**Extern """Windows"""**## blocks provide a default ##[[KeyPgStdcall Stdcall]]## calling convention to procedures, preserve the case of all names declared within them, and on the Windows platform, append a ##"@//N//"## suffix to procedure names, where ##//N//## is the total size in bytes of any procedure parameters. Similar to the ##**Extern """C"""**## block, the same effect can be achieved by using ##[[KeyPgStdcall stdcall]]## and ##[[KeyPgAlias alias]]##.
##**Extern """Windows-MS"""**## blocks are exactly like ##**Extern """Windows"""**## blocks but do not append the ##"@//N//"## suffix to procedure names on Windows.
'' as "YetAnotherProcedure@4" on Windows, and
'' "YetAnotherProcedure" on Linux, *BSD and DOS.
extern "Windows-MS"
'' as "YetAnotherProcedure".
- On Linux, *BSD and DOS platforms, ##**Extern "Windows"**## blocks never append a ##"@//N//"## suffix to procedure names, and thus are equal to ##**Extern "Windows-MS"**##.
Deletions:
##**Extern """C"""**## blocks provide a default ##[[KeyPgCdecl Cdecl]]## calling convention to procedures, and also preserve the case of all names declared within them.
##**Extern """Windows"""**## blocks provide a default ##[[KeyPgStdcall Stdcall]]## calling convention to procedures, preserve the case of all names declared within them and on DOS/Windows platforms, append a ##"@//N//"## suffix to procedure names, where ##//N//## is the total size in bytes of any procedure parameters.
##**Extern """Windows-MS"""**## blocks are exactly like ##**Extern """Windows"""**## blocks but do not append the ##"@//N//"## suffix to procedure names in DOS/Windows platforms.
'' as "YetAnotherProcedure@4" on DOS/Windows platforms, and
'' "YetAnotherProcedure" on Linux platforms.
- In Linux platforms, ##**Extern "Windows"**## blocks never append a ##"@//N//"## suffix to procedure names.


Revision [14850]

Edited on 2010-10-05 13:06:33 by DkLwikki [Updated to document the use of LIB "libname" on EXTERN blocks]
Additions:
**Extern { """C""" | """C++""" | """Windows""" | """Windows-MS""" }** [ **[[KeyPgLib Lib]]** "//libname//" ]

##[[KeyPgLib Lib]] "//libname//"## can be used to specify a library which will be linked in as if ##[[KeyPgInclib #inclib "libname"]]## or ##[[CompilerOptl -l libname]]## had been used. Additionally, all procedure declarations inside the **Extern** block will use the specified ##[[KeyPgLib Lib]] "//libname//"## as if it was specified as part of their declarations (but it can still be overridden with an explicit ##[[KeyPgLib Lib]] "//libname//"##).
Deletions:
**Extern { """C""" | """C++""" | """Windows""" | """Windows-MS"""** }


Revision [14582]

Edited on 2010-05-10 01:19:39 by ChA0s [Removed words about external linkage]
Additions:
Statement block to allow calling of functions compiled for specific languages or platforms.
##**Extern**## blocks provide default calling conventions for procedures and mandate a certain name decoration.
Deletions:
Statement block to give external linkage to declarative statements
##**Extern**## blocks give external linkage to the names declared within them. They also provide default calling conventions for procedures and mandate a certain name decoration.


Revision [14345]

Edited on 2009-08-29 21:54:04 by CountingPine [Remove CamelCase links in "New to FreeBASIC"]
Additions:
- New to ""FreeBASIC""
Deletions:
- New to FreeBASIC


Revision [12320]

The oldest known version of this page was created on 2008-01-18 14:13:01 by JeffMarshall [Remove CamelCase links in "New to FreeBASIC"]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode