C API design

C API , . C C API. , C - API. API , , , . C API, Vulkan . C API.





API . . API, . , (ABI, Application Binary Interface), , β€” API .





, API shared object/DLL. C API . , . , . C API . sqlite, libpng, Win32, ​​Linux β€” .





? , , :

















.





API

API . API ABI, API β€” , myFunctionEx



myFunctionV2



. , .





, . API, β€” API.





, C API, , , . , , .





API

API , API. , , shared object DLL , . (.. ). , , , ? - , API. , OpenCL GLEW. , 100% , .





. GLEW XML-. OpenCL , . β€” .





API

API? , ? C API .





Vulkan. , , , . , , , API. - API. 





Vulkan API, vk.xml , . , . , GLEW.





API

, , :





  • , β€” . . 





  • . .





  • API () β€” .





C++ COM, . API: 





  • , API. 





  • API.





- , .





API? , :





struct ImgApi
{
    int (*LoadPng) (ImgApi* api, const char* filename,
        Image* handle);
    int (*ReadPixels) (ImgApi* api, Image* handle,
        void* target);
    // or
    int (*ReadPixels) (Image* handle, void* target);

    // Various other entry points
};

// public entry points for V1_0
int CreateMyImgIOApiV1_0 (ImgApi** api);
int DestroyMyImgIOApiV1_0 (ImgApi* api);
      
      







? :





  • β€” . , .





  • ! ImgApiV2



    , , .





  • , , ! ImgApi



    . - , Image



    .





, . , API, . ? , β€” . .





, , API, , . . , , : , , , C++ , .





, . , API API: XML, JSON - . , , .





. API, C API, .






Demo Day " ". , , , .













All Articles