Extern...End Extern
 
Statement block to allow calling of functions compiled for specific languages or platforms.

Syntax

Extern { "C" | "C++" | "Windows" | "Windows-MS" } [ Lib "libname" ]
declarative statements
End Extern

Description

Extern blocks provide default calling conventions for procedures and mandate a certain name decoration.

Extern "C" blocks provide a default 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 cdecl together with an Alias string containing the exact procedure name.

Extern "C++" blocks are exactly like Extern "C" blocks but they also mangle the names declared within them in a way compatible to that of g++-4.x.

Extern "Windows" blocks provide a default 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 stdcall and Alias.

Extern "Windows-MS" blocks are exactly like Extern "Windows" blocks but do not append the "@N" suffix to procedure names on Windows.

Lib "libname" can be used to specify a library which will be linked in as if #Inclib "Libname" or -l libname had been used. Additionally, all procedure declarations inside the Extern block will use the specified Lib "libname" as if it was specified as part of their declarations (but it can still be overridden with an explicit Lib "libname").

Example

Extern "C"
    '' This procedure uses the CDECL convention and is seen externally
    '' as "SomeProcedure".
    Declare Sub SomeProcedure ( ByVal As Integer )
End Extern

Extern "C++"
    '' This procedure uses the CDECL convention and its name is mangled
    '' compatible to that of g++-4.x.
    Declare Function AnotherProcedure ( ByVal As Integer ) As Integer
End Extern

Extern "Windows"
    '' This procedure uses the STDCALL convention and is seen externally
    '' 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"
    '' This procedure uses the STDCALL convention and is seen externally
    '' as "YetAnotherProcedure".
    Declare Function YetAnotherProcedure ( ByVal As Integer ) As Integer
End Extern


Dialect Differences

  • Extern blocks are only available in the -lang fb dialect.

Differences from QB

  • New to FreeBASIC

Platform Differences

  • 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".

See also

Сайт ПДСНПСР. Если ты патриот России - жми сюда!


Знаете ли Вы, что электромагнитное и другие поля есть различные типы колебаний, деформаций и вариаций давления в эфире.

Понятие же "физического вакуума" в релятивистской квантовой теории поля подразумевает, что во-первых, он не имеет физической природы, в нем лишь виртуальные частицы у которых нет физической системы отсчета, это "фантомы", во-вторых, "физический вакуум" - это наинизшее состояние поля, "нуль-точка", что противоречит реальным фактам, так как, на самом деле, вся энергия материи содержится в эфире и нет иной энергии и иного носителя полей и вещества кроме самого эфира.

В отличие от лукавого понятия "физический вакуум", как бы совместимого с релятивизмом, понятие "эфир" подразумевает наличие базового уровня всей физической материи, имеющего как собственную систему отсчета (обнаруживаемую экспериментально, например, через фоновое космичекое излучение, - тепловое излучение самого эфира), так и являющимся носителем 100% энергии вселенной, а не "нуль-точкой" или "остаточными", "нулевыми колебаниями пространства". Подробнее читайте в FAQ по эфирной физике.

НОВОСТИ ФОРУМАФорум Рыцари теории эфира
Рыцари теории эфира
 10.11.2021 - 12:37: ПЕРСОНАЛИИ - Personalias -> WHO IS WHO - КТО ЕСТЬ КТО - Карим_Хайдаров.
10.11.2021 - 12:36: СОВЕСТЬ - Conscience -> РАСЧЕЛОВЕЧИВАНИЕ ЧЕЛОВЕКА. КОМУ ЭТО НАДО? - Карим_Хайдаров.
10.11.2021 - 12:36: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от д.м.н. Александра Алексеевича Редько - Карим_Хайдаров.
10.11.2021 - 12:35: ЭКОЛОГИЯ - Ecology -> Биологическая безопасность населения - Карим_Хайдаров.
10.11.2021 - 12:34: ВОЙНА, ПОЛИТИКА И НАУКА - War, Politics and Science -> Проблема государственного терроризма - Карим_Хайдаров.
10.11.2021 - 12:34: ВОЙНА, ПОЛИТИКА И НАУКА - War, Politics and Science -> ПРАВОСУДИЯ.НЕТ - Карим_Хайдаров.
10.11.2021 - 12:34: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Вадима Глогера, США - Карим_Хайдаров.
10.11.2021 - 09:18: НОВЫЕ ТЕХНОЛОГИИ - New Technologies -> Волновая генетика Петра Гаряева, 5G-контроль и управление - Карим_Хайдаров.
10.11.2021 - 09:18: ЭКОЛОГИЯ - Ecology -> ЭКОЛОГИЯ ДЛЯ ВСЕХ - Карим_Хайдаров.
10.11.2021 - 09:16: ЭКОЛОГИЯ - Ecology -> ПРОБЛЕМЫ МЕДИЦИНЫ - Карим_Хайдаров.
10.11.2021 - 09:15: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Екатерины Коваленко - Карим_Хайдаров.
10.11.2021 - 09:13: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Вильгельма Варкентина - Карим_Хайдаров.
Bourabai Research Institution home page

Боровское исследовательское учреждение - Bourabai Research Bourabai Research Institution