CodeFest 2013. Белый И. — Marmalade SDK. Что под капотом?
Upcoming SlideShare
Loading in...5
×
 

CodeFest 2013. Белый И. — Marmalade SDK. Что под капотом?

on

  • 737 views

 

Statistics

Views

Total Views
737
Slideshare-icon Views on SlideShare
633
Embed Views
104

Actions

Likes
0
Downloads
0
Comments
0

2 Embeds 104

http://2013.codefest.ru 103
http://hghltd.yandex.net 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • We’ve seen what Marmalade can do, and from a high level how it does it, but what is the Marmalade SDK?***At the very bottom we find the device specific layer, OS, device drivers, graphics capabilities. This is where a developer would normally start, and this is where the cross platform difficulties arise, each device has it’s own specific flavour for this layer.***“Marmalade System” – one of the two main components of Marmalade sits on top of this.Abstracts the low level functionality.C runtimeMemory managementDevice accessAccelerometer and other device featuresCameraStorageGraphics subsystems such as OpenGL ESCommon functionality is built against this low level API, this is where you can leverage existing code, internal or external. Because Marmalade offers a seamless layer on top of the common functionality, porting to it is an exercise in simplicity, many times the vast majority of existing C/C++ code ports directly with little to no changes. Marmalade takes care of making sure that when you call malloc or new, it’s actually the Marmalade System implementation that gets called. Typical modules that get ported at this level for use in multiple titles include….***Physics libraries***Scripting languages***Many others, databases, image processing, etc.Scaleform for integrated Flash support.***Github also hosts many, already ported open source libraries, ready for you to include into your projects.***“Marmalade Studio” – the second main component of Marmalade sits on top of this. Studio provides a common set of modules for rapidly developing high quality games.***2D and 3D gfx, networking, text and font handling, UI (native and custom), resource management etc. All the things you need to get started. All carefully crafted to provide common API’s that apply across platforms, providing much of the common code needed to get moving quickly.It’s worth noting that Studio is not a game engine, but rather the ingredients necessary for you to build your game engine in a cross platform way, or, as is often the case, port an existing game engine.Using Studio functionality abstracts implementation details at a higher level than System. For example, IwGX, the graphics module, allows you to perform common graphics functionality without consideration for the capabilities of the platform, does it have GLES, is it GLES1 or 2, do you need to fall back to a software renderer? All this is handled by the module, you just right the game.***On top of this you build your application.It’s important to realise that it’s you who decides which parts of Marmalade you use. You can choose to sidestep Studio altogether, and develop directly against the lower level System API that’s fine, you still get all the cross platform benefits.But…what if you need to go lower, what if you need access to some device functionality Marmalade doesn’t provide? As an example, suppose a device provider introduced a new API for in app purchase, not supported by Marmalade out of the box, and different for each platform, but you need it for your game, how do you do that?***
  • We’ve seen what Marmalade can do, and from a high level how it does it, but what is the Marmalade SDK?***At the very bottom we find the device specific layer, OS, device drivers, graphics capabilities. This is where a developer would normally start, and this is where the cross platform difficulties arise, each device has it’s own specific flavour for this layer.***“Marmalade System” – one of the two main components of Marmalade sits on top of this.Abstracts the low level functionality.C runtimeMemory managementDevice accessAccelerometer and other device featuresCameraStorageGraphics subsystems such as OpenGL ESCommon functionality is built against this low level API, this is where you can leverage existing code, internal or external. Because Marmalade offers a seamless layer on top of the common functionality, porting to it is an exercise in simplicity, many times the vast majority of existing C/C++ code ports directly with little to no changes. Marmalade takes care of making sure that when you call malloc or new, it’s actually the Marmalade System implementation that gets called. Typical modules that get ported at this level for use in multiple titles include….***Physics libraries***Scripting languages***Many others, databases, image processing, etc.Scaleform for integrated Flash support.***Github also hosts many, already ported open source libraries, ready for you to include into your projects.***“Marmalade Studio” – the second main component of Marmalade sits on top of this. Studio provides a common set of modules for rapidly developing high quality games.***2D and 3D gfx, networking, text and font handling, UI (native and custom), resource management etc. All the things you need to get started. All carefully crafted to provide common API’s that apply across platforms, providing much of the common code needed to get moving quickly.It’s worth noting that Studio is not a game engine, but rather the ingredients necessary for you to build your game engine in a cross platform way, or, as is often the case, port an existing game engine.Using Studio functionality abstracts implementation details at a higher level than System. For example, IwGX, the graphics module, allows you to perform common graphics functionality without consideration for the capabilities of the platform, does it have GLES, is it GLES1 or 2, do you need to fall back to a software renderer? All this is handled by the module, you just right the game.***On top of this you build your application.It’s important to realise that it’s you who decides which parts of Marmalade you use. You can choose to sidestep Studio altogether, and develop directly against the lower level System API that’s fine, you still get all the cross platform benefits.But…what if you need to go lower, what if you need access to some device functionality Marmalade doesn’t provide? As an example, suppose a device provider introduced a new API for in app purchase, not supported by Marmalade out of the box, and different for each platform, but you need it for your game, how do you do that?***
  • We’ve seen what Marmalade can do, and from a high level how it does it, but what is the Marmalade SDK?***At the very bottom we find the device specific layer, OS, device drivers, graphics capabilities. This is where a developer would normally start, and this is where the cross platform difficulties arise, each device has it’s own specific flavour for this layer.***“Marmalade System” – one of the two main components of Marmalade sits on top of this.Abstracts the low level functionality.C runtimeMemory managementDevice accessAccelerometer and other device featuresCameraStorageGraphics subsystems such as OpenGL ESCommon functionality is built against this low level API, this is where you can leverage existing code, internal or external. Because Marmalade offers a seamless layer on top of the common functionality, porting to it is an exercise in simplicity, many times the vast majority of existing C/C++ code ports directly with little to no changes. Marmalade takes care of making sure that when you call malloc or new, it’s actually the Marmalade System implementation that gets called. Typical modules that get ported at this level for use in multiple titles include….***Physics libraries***Scripting languages***Many others, databases, image processing, etc.Scaleform for integrated Flash support.***Github also hosts many, already ported open source libraries, ready for you to include into your projects.***“Marmalade Studio” – the second main component of Marmalade sits on top of this. Studio provides a common set of modules for rapidly developing high quality games.***2D and 3D gfx, networking, text and font handling, UI (native and custom), resource management etc. All the things you need to get started. All carefully crafted to provide common API’s that apply across platforms, providing much of the common code needed to get moving quickly.It’s worth noting that Studio is not a game engine, but rather the ingredients necessary for you to build your game engine in a cross platform way, or, as is often the case, port an existing game engine.Using Studio functionality abstracts implementation details at a higher level than System. For example, IwGX, the graphics module, allows you to perform common graphics functionality without consideration for the capabilities of the platform, does it have GLES, is it GLES1 or 2, do you need to fall back to a software renderer? All this is handled by the module, you just right the game.***On top of this you build your application.It’s important to realise that it’s you who decides which parts of Marmalade you use. You can choose to sidestep Studio altogether, and develop directly against the lower level System API that’s fine, you still get all the cross platform benefits.But…what if you need to go lower, what if you need access to some device functionality Marmalade doesn’t provide? As an example, suppose a device provider introduced a new API for in app purchase, not supported by Marmalade out of the box, and different for each platform, but you need it for your game, how do you do that?***
  • We’ve seen what Marmalade can do, and from a high level how it does it, but what is the Marmalade SDK?***At the very bottom we find the device specific layer, OS, device drivers, graphics capabilities. This is where a developer would normally start, and this is where the cross platform difficulties arise, each device has it’s own specific flavour for this layer.***“Marmalade System” – one of the two main components of Marmalade sits on top of this.Abstracts the low level functionality.C runtimeMemory managementDevice accessAccelerometer and other device featuresCameraStorageGraphics subsystems such as OpenGL ESCommon functionality is built against this low level API, this is where you can leverage existing code, internal or external. Because Marmalade offers a seamless layer on top of the common functionality, porting to it is an exercise in simplicity, many times the vast majority of existing C/C++ code ports directly with little to no changes. Marmalade takes care of making sure that when you call malloc or new, it’s actually the Marmalade System implementation that gets called. Typical modules that get ported at this level for use in multiple titles include….***Physics libraries***Scripting languages***Many others, databases, image processing, etc.Scaleform for integrated Flash support.***Github also hosts many, already ported open source libraries, ready for you to include into your projects.***“Marmalade Studio” – the second main component of Marmalade sits on top of this. Studio provides a common set of modules for rapidly developing high quality games.***2D and 3D gfx, networking, text and font handling, UI (native and custom), resource management etc. All the things you need to get started. All carefully crafted to provide common API’s that apply across platforms, providing much of the common code needed to get moving quickly.It’s worth noting that Studio is not a game engine, but rather the ingredients necessary for you to build your game engine in a cross platform way, or, as is often the case, port an existing game engine.Using Studio functionality abstracts implementation details at a higher level than System. For example, IwGX, the graphics module, allows you to perform common graphics functionality without consideration for the capabilities of the platform, does it have GLES, is it GLES1 or 2, do you need to fall back to a software renderer? All this is handled by the module, you just right the game.***On top of this you build your application.It’s important to realise that it’s you who decides which parts of Marmalade you use. You can choose to sidestep Studio altogether, and develop directly against the lower level System API that’s fine, you still get all the cross platform benefits.But…what if you need to go lower, what if you need access to some device functionality Marmalade doesn’t provide? As an example, suppose a device provider introduced a new API for in app purchase, not supported by Marmalade out of the box, and different for each platform, but you need it for your game, how do you do that?***
  • We’ve seen what Marmalade can do, and from a high level how it does it, but what is the Marmalade SDK?***At the very bottom we find the device specific layer, OS, device drivers, graphics capabilities. This is where a developer would normally start, and this is where the cross platform difficulties arise, each device has it’s own specific flavour for this layer.***“Marmalade System” – one of the two main components of Marmalade sits on top of this.Abstracts the low level functionality.C runtimeMemory managementDevice accessAccelerometer and other device featuresCameraStorageGraphics subsystems such as OpenGL ESCommon functionality is built against this low level API, this is where you can leverage existing code, internal or external. Because Marmalade offers a seamless layer on top of the common functionality, porting to it is an exercise in simplicity, many times the vast majority of existing C/C++ code ports directly with little to no changes. Marmalade takes care of making sure that when you call malloc or new, it’s actually the Marmalade System implementation that gets called. Typical modules that get ported at this level for use in multiple titles include….***Physics libraries***Scripting languages***Many others, databases, image processing, etc.Scaleform for integrated Flash support.***Github also hosts many, already ported open source libraries, ready for you to include into your projects.***“Marmalade Studio” – the second main component of Marmalade sits on top of this. Studio provides a common set of modules for rapidly developing high quality games.***2D and 3D gfx, networking, text and font handling, UI (native and custom), resource management etc. All the things you need to get started. All carefully crafted to provide common API’s that apply across platforms, providing much of the common code needed to get moving quickly.It’s worth noting that Studio is not a game engine, but rather the ingredients necessary for you to build your game engine in a cross platform way, or, as is often the case, port an existing game engine.Using Studio functionality abstracts implementation details at a higher level than System. For example, IwGX, the graphics module, allows you to perform common graphics functionality without consideration for the capabilities of the platform, does it have GLES, is it GLES1 or 2, do you need to fall back to a software renderer? All this is handled by the module, you just right the game.***On top of this you build your application.It’s important to realise that it’s you who decides which parts of Marmalade you use. You can choose to sidestep Studio altogether, and develop directly against the lower level System API that’s fine, you still get all the cross platform benefits.But…what if you need to go lower, what if you need access to some device functionality Marmalade doesn’t provide? As an example, suppose a device provider introduced a new API for in app purchase, not supported by Marmalade out of the box, and different for each platform, but you need it for your game, how do you do that?***
  • We’ve seen what Marmalade can do, and from a high level how it does it, but what is the Marmalade SDK?***At the very bottom we find the device specific layer, OS, device drivers, graphics capabilities. This is where a developer would normally start, and this is where the cross platform difficulties arise, each device has it’s own specific flavour for this layer.***“Marmalade System” – one of the two main components of Marmalade sits on top of this.Abstracts the low level functionality.C runtimeMemory managementDevice accessAccelerometer and other device featuresCameraStorageGraphics subsystems such as OpenGL ESCommon functionality is built against this low level API, this is where you can leverage existing code, internal or external. Because Marmalade offers a seamless layer on top of the common functionality, porting to it is an exercise in simplicity, many times the vast majority of existing C/C++ code ports directly with little to no changes. Marmalade takes care of making sure that when you call malloc or new, it’s actually the Marmalade System implementation that gets called. Typical modules that get ported at this level for use in multiple titles include….***Physics libraries***Scripting languages***Many others, databases, image processing, etc.Scaleform for integrated Flash support.***Github also hosts many, already ported open source libraries, ready for you to include into your projects.***“Marmalade Studio” – the second main component of Marmalade sits on top of this. Studio provides a common set of modules for rapidly developing high quality games.***2D and 3D gfx, networking, text and font handling, UI (native and custom), resource management etc. All the things you need to get started. All carefully crafted to provide common API’s that apply across platforms, providing much of the common code needed to get moving quickly.It’s worth noting that Studio is not a game engine, but rather the ingredients necessary for you to build your game engine in a cross platform way, or, as is often the case, port an existing game engine.Using Studio functionality abstracts implementation details at a higher level than System. For example, IwGX, the graphics module, allows you to perform common graphics functionality without consideration for the capabilities of the platform, does it have GLES, is it GLES1 or 2, do you need to fall back to a software renderer? All this is handled by the module, you just right the game.***On top of this you build your application.It’s important to realise that it’s you who decides which parts of Marmalade you use. You can choose to sidestep Studio altogether, and develop directly against the lower level System API that’s fine, you still get all the cross platform benefits.But…what if you need to go lower, what if you need access to some device functionality Marmalade doesn’t provide? As an example, suppose a device provider introduced a new API for in app purchase, not supported by Marmalade out of the box, and different for each platform, but you need it for your game, how do you do that?***
  • We’ve seen what Marmalade can do, and from a high level how it does it, but what is the Marmalade SDK?***At the very bottom we find the device specific layer, OS, device drivers, graphics capabilities. This is where a developer would normally start, and this is where the cross platform difficulties arise, each device has it’s own specific flavour for this layer.***“Marmalade System” – one of the two main components of Marmalade sits on top of this.Abstracts the low level functionality.C runtimeMemory managementDevice accessAccelerometer and other device featuresCameraStorageGraphics subsystems such as OpenGL ESCommon functionality is built against this low level API, this is where you can leverage existing code, internal or external. Because Marmalade offers a seamless layer on top of the common functionality, porting to it is an exercise in simplicity, many times the vast majority of existing C/C++ code ports directly with little to no changes. Marmalade takes care of making sure that when you call malloc or new, it’s actually the Marmalade System implementation that gets called. Typical modules that get ported at this level for use in multiple titles include….***Physics libraries***Scripting languages***Many others, databases, image processing, etc.Scaleform for integrated Flash support.***Github also hosts many, already ported open source libraries, ready for you to include into your projects.***“Marmalade Studio” – the second main component of Marmalade sits on top of this. Studio provides a common set of modules for rapidly developing high quality games.***2D and 3D gfx, networking, text and font handling, UI (native and custom), resource management etc. All the things you need to get started. All carefully crafted to provide common API’s that apply across platforms, providing much of the common code needed to get moving quickly.It’s worth noting that Studio is not a game engine, but rather the ingredients necessary for you to build your game engine in a cross platform way, or, as is often the case, port an existing game engine.Using Studio functionality abstracts implementation details at a higher level than System. For example, IwGX, the graphics module, allows you to perform common graphics functionality without consideration for the capabilities of the platform, does it have GLES, is it GLES1 or 2, do you need to fall back to a software renderer? All this is handled by the module, you just right the game.***On top of this you build your application.It’s important to realise that it’s you who decides which parts of Marmalade you use. You can choose to sidestep Studio altogether, and develop directly against the lower level System API that’s fine, you still get all the cross platform benefits.But…what if you need to go lower, what if you need access to some device functionality Marmalade doesn’t provide? As an example, suppose a device provider introduced a new API for in app purchase, not supported by Marmalade out of the box, and different for each platform, but you need it for your game, how do you do that?***
  • We’ve seen what Marmalade can do, and from a high level how it does it, but what is the Marmalade SDK?***At the very bottom we find the device specific layer, OS, device drivers, graphics capabilities. This is where a developer would normally start, and this is where the cross platform difficulties arise, each device has it’s own specific flavour for this layer.***“Marmalade System” – one of the two main components of Marmalade sits on top of this.Abstracts the low level functionality.C runtimeMemory managementDevice accessAccelerometer and other device featuresCameraStorageGraphics subsystems such as OpenGL ESCommon functionality is built against this low level API, this is where you can leverage existing code, internal or external. Because Marmalade offers a seamless layer on top of the common functionality, porting to it is an exercise in simplicity, many times the vast majority of existing C/C++ code ports directly with little to no changes. Marmalade takes care of making sure that when you call malloc or new, it’s actually the Marmalade System implementation that gets called. Typical modules that get ported at this level for use in multiple titles include….***Physics libraries***Scripting languages***Many others, databases, image processing, etc.Scaleform for integrated Flash support.***Github also hosts many, already ported open source libraries, ready for you to include into your projects.***“Marmalade Studio” – the second main component of Marmalade sits on top of this. Studio provides a common set of modules for rapidly developing high quality games.***2D and 3D gfx, networking, text and font handling, UI (native and custom), resource management etc. All the things you need to get started. All carefully crafted to provide common API’s that apply across platforms, providing much of the common code needed to get moving quickly.It’s worth noting that Studio is not a game engine, but rather the ingredients necessary for you to build your game engine in a cross platform way, or, as is often the case, port an existing game engine.Using Studio functionality abstracts implementation details at a higher level than System. For example, IwGX, the graphics module, allows you to perform common graphics functionality without consideration for the capabilities of the platform, does it have GLES, is it GLES1 or 2, do you need to fall back to a software renderer? All this is handled by the module, you just right the game.***On top of this you build your application.It’s important to realise that it’s you who decides which parts of Marmalade you use. You can choose to sidestep Studio altogether, and develop directly against the lower level System API that’s fine, you still get all the cross platform benefits.But…what if you need to go lower, what if you need access to some device functionality Marmalade doesn’t provide? As an example, suppose a device provider introduced a new API for in app purchase, not supported by Marmalade out of the box, and different for each platform, but you need it for your game, how do you do that?***
  • We’ve seen what Marmalade can do, and from a high level how it does it, but what is the Marmalade SDK?***At the very bottom we find the device specific layer, OS, device drivers, graphics capabilities. This is where a developer would normally start, and this is where the cross platform difficulties arise, each device has it’s own specific flavour for this layer.***“Marmalade System” – one of the two main components of Marmalade sits on top of this.Abstracts the low level functionality.C runtimeMemory managementDevice accessAccelerometer and other device featuresCameraStorageGraphics subsystems such as OpenGL ESCommon functionality is built against this low level API, this is where you can leverage existing code, internal or external. Because Marmalade offers a seamless layer on top of the common functionality, porting to it is an exercise in simplicity, many times the vast majority of existing C/C++ code ports directly with little to no changes. Marmalade takes care of making sure that when you call malloc or new, it’s actually the Marmalade System implementation that gets called. Typical modules that get ported at this level for use in multiple titles include….***Physics libraries***Scripting languages***Many others, databases, image processing, etc.Scaleform for integrated Flash support.***Github also hosts many, already ported open source libraries, ready for you to include into your projects.***“Marmalade Studio” – the second main component of Marmalade sits on top of this. Studio provides a common set of modules for rapidly developing high quality games.***2D and 3D gfx, networking, text and font handling, UI (native and custom), resource management etc. All the things you need to get started. All carefully crafted to provide common API’s that apply across platforms, providing much of the common code needed to get moving quickly.It’s worth noting that Studio is not a game engine, but rather the ingredients necessary for you to build your game engine in a cross platform way, or, as is often the case, port an existing game engine.Using Studio functionality abstracts implementation details at a higher level than System. For example, IwGX, the graphics module, allows you to perform common graphics functionality without consideration for the capabilities of the platform, does it have GLES, is it GLES1 or 2, do you need to fall back to a software renderer? All this is handled by the module, you just right the game.***On top of this you build your application.It’s important to realise that it’s you who decides which parts of Marmalade you use. You can choose to sidestep Studio altogether, and develop directly against the lower level System API that’s fine, you still get all the cross platform benefits.But…what if you need to go lower, what if you need access to some device functionality Marmalade doesn’t provide? As an example, suppose a device provider introduced a new API for in app purchase, not supported by Marmalade out of the box, and different for each platform, but you need it for your game, how do you do that?***
  • We’ve seen what Marmalade can do, and from a high level how it does it, but what is the Marmalade SDK?***At the very bottom we find the device specific layer, OS, device drivers, graphics capabilities. This is where a developer would normally start, and this is where the cross platform difficulties arise, each device has it’s own specific flavour for this layer.***“Marmalade System” – one of the two main components of Marmalade sits on top of this.Abstracts the low level functionality.C runtimeMemory managementDevice accessAccelerometer and other device featuresCameraStorageGraphics subsystems such as OpenGL ESCommon functionality is built against this low level API, this is where you can leverage existing code, internal or external. Because Marmalade offers a seamless layer on top of the common functionality, porting to it is an exercise in simplicity, many times the vast majority of existing C/C++ code ports directly with little to no changes. Marmalade takes care of making sure that when you call malloc or new, it’s actually the Marmalade System implementation that gets called. Typical modules that get ported at this level for use in multiple titles include….***Physics libraries***Scripting languages***Many others, databases, image processing, etc.Scaleform for integrated Flash support.***Github also hosts many, already ported open source libraries, ready for you to include into your projects.***“Marmalade Studio” – the second main component of Marmalade sits on top of this. Studio provides a common set of modules for rapidly developing high quality games.***2D and 3D gfx, networking, text and font handling, UI (native and custom), resource management etc. All the things you need to get started. All carefully crafted to provide common API’s that apply across platforms, providing much of the common code needed to get moving quickly.It’s worth noting that Studio is not a game engine, but rather the ingredients necessary for you to build your game engine in a cross platform way, or, as is often the case, port an existing game engine.Using Studio functionality abstracts implementation details at a higher level than System. For example, IwGX, the graphics module, allows you to perform common graphics functionality without consideration for the capabilities of the platform, does it have GLES, is it GLES1 or 2, do you need to fall back to a software renderer? All this is handled by the module, you just right the game.***On top of this you build your application.It’s important to realise that it’s you who decides which parts of Marmalade you use. You can choose to sidestep Studio altogether, and develop directly against the lower level System API that’s fine, you still get all the cross platform benefits.But…what if you need to go lower, what if you need access to some device functionality Marmalade doesn’t provide? As an example, suppose a device provider introduced a new API for in app purchase, not supported by Marmalade out of the box, and different for each platform, but you need it for your game, how do you do that?***
  • Each layer talks to next layer down. Layers below need no knowledge of layers aboveOnce these layers are separated, they can be compiled independently.VM based languages use platform independent Byte code. VM provides common API.
  • For C++, traditionally, can be done with libraries which are linked together.Using a standard library like libpng.We want intercept fopen because otherwise would have to vary “path” by platform(Or add profiling. Or add custom memory allocation routine for malloc).Don’t want to have to replace fopen() with my_fopen()How do we use custom fopen() ?
  • Replacing fopen means changing our C standard library used by our compilerWhen using gcc or llvm we can use newlib as our C standard library (libc.a & libm.a & …)http://wiki.osdev.org/Porting_NewlibNewlibcan be compiled „stand alone” –meaningwithoutany platform specificcde.Thisiscommonlydone for „bare-metal” / „bareboard” targetsAll you need to support a set of 19 system calls that act as ‘glue’ between newlib and the OS
  • Problem is we now have two libraries containing fopen – newlib & platforms – how to get the right one?Prelink application to newlib. This technique is commonly used to remove dependencies on 3rd party libraries by combining these dependencies into a single conglomerate libraryIt pulls in as many symbol definitions as it can (but doesn’t complain about undefined symbols)In XCode this is known as “Single-Object Prelink of static libraries”. Prelink is very fucking intimate thing for every particular platformWant to hide most symbols (such as our custom fopen) within library.Some symbols need to remain visible – such as the entry point for the applicationWe run “ld” again passing prelinked application library and platform library (loader).Platforms used this for are Sony PSP, Nintendo DS, LG TV (Linux based), etc.
  • Linking at runtime we can reuse a single application binary. No need to rebuild for new platform.Bugs in application library are platform independent (can be debugged on any system).Moving to new platform, new bugs can only be in platform layer.We’re effectively creating a virtual environment for our application.We can take complete control of memory heaps, file system & add profiling metrics.
  • Unlike many proprietary executable file formats, ELF is flexible and extensible, and it is not bound to any particular processor or architecture. This has allowed it to be adopted by many different operating systems on many different platforms. Such as Linux, BeOS, Symbian, Bada, PlayStation 2&3, Wii,The ELF file format is also used as a generic object and executable format for binary images used.The Windows analogue is PE – Portable Executable. Darwin it's Mach-OPosition Independent CodePosition independent code can be copied to any memory location without modification and then executed, unlike relocatable code which requires special processing by a runtime linker to make it suitable for execution at a given location.Global offset TableELF linkers support position independent code (PIC) through the GOT in each shared library. The GOT contains absolute addresses to all of the static data referenced in the program. The address of the GOT is normally stored in a register (EBX on x86 / r9 on ARM) which is a relative address from the code that references it.Procedure Linkage Table (PLT)Similar to how the GOT redirects any position-independent address calculations to absolute locations, the PLT redirects position-independent function calls to absolute locations.Apart from these two tables, the linker also refers to .dynsym, which contains all of the file's imported and exported symbols, .dynstr, which contains name strings for the symbols.http://www.symantec.com/connect/articles/dynamic-linking-linux-and-windows-part-one

CodeFest 2013. Белый И. — Marmalade SDK. Что под капотом? CodeFest 2013. Белый И. — Marmalade SDK. Что под капотом? Presentation Transcript

  • Marmalade SDKЧто под капотом?
  • Marmalade SDK открытый и гибкийЧерный ящикАльтернативные движкиДоступны плагины с закрытым кодомMarmalade SystemMarmaladeДоступны плагины с открытым кодомМодули MarmaladeМодули с открытымкодом
  • Программный стек Marmalade: УстройстваТипичное место, откуда обычно разработчик безMarmalade SDK начинает строить приложениеВсе устрйства/ОС разные и требуют от разработчикаредизайна приложения для каждой конкретнойплатформыОСДрайверыOpenGL ESУстройство
  • Marmalade СистемаБыстрый и эффективный доступ к APIОС, управление памятью и графическойподсистемой устройства.Одинаковый набор API на всех поддерживаемыхплатформахГрафика Кросс платформ. APIMarmaladeСистемаОСДрайверыOpenGL ESУстройство
  • Стандартные C/C++ библиотекиПодавляющее большинство существующего С/С++кода портируется сразу, с минимальнымиизменениями или без них вообщеC/C++ стандартные библиотекиГрафика Кросс платформ. APIОСДрайверыOpenGL ESУстройствоГрафика Кросс платформ. APIMarmaladeСистема
  • Модули Marmalade StudioMarmalade Studio предоставляет стандартный набормодулей для быстрой разработки приложений“Marmalade Studio”C/C++ стандартные библиотекиОСДрайверыOpenGL ESУстройствоГрафика Кросс платформ. APIMarmaladeСистема
  • Интеграция модулейВыбирайте среди разнообразия сторонних модулейкоторые работают с Marmalade прямо «из коробки»Другие модули“Marmalade Studio”C/C++ стандартные библиотекиОСДрайверыOpenGL ESУстройствоГрафика Кросс платформ. APIMarmaladeСистема
  • РасширенияПолучайте доступ к платформенно зависимымфункциям и коду, используя расширения MarmaladeВыбирайте из набора предустановленныхрасширений или создавайте свои собственныеиспользуя EDKПлатформ.расширенияДругие модули“Marmalade Studio”C/C++ стандартные библиотекиОСДрайверыOpenGL ESУстройствоГрафика Кросс платформ. APIMarmaladeСистема
  • Ваше приложениеИспользовать модули Marmalade Studio, APIпартнерских проектов или получить доступ книзкоуровневым APIs напрямую – ваш выборПлатформ.расширенияКод вашего приложенияДругие модули“Marmalade Studio”C/C++ стандартные библиотекиОСДрайверыOpenGL ESУстройствоГрафика Кросс платформ. APIMarmaladeСистема
  • Концепции Marmalade: загрузчикГрафикаЗагрузчик Кросс-платформенные APIПлатформенно зависимый загрузчик который компонуется с вашимприложением во время упаковки, чтобы создать платформенно зависимыйустановочный пакетХранит платформенно зависимые реализации системы Marmalade длястандартного набора низкоуровневых APIПриложения получают доступ к API напрямую или через наборвысокоуровневых модулейСовсем крошечный дополнительный объем к вашему приложению, обычнооколо 400kb
  • Концепции Marmalade: бинарникприложенияКросс-платформенный, ОС-независимый пакетСодержит ваш код и дополнительные модулиКомпилируется в нативные инструкции CPUНеиспользуемый функционал выбрасывается. Приложение зря не раздуваетсяПодтверждает, что 97% кода приложения – это идентичные инструкции CPU навсех устройствахКомпонуется с платформенно зависимым загрузчиком на этапе упаковки длясоздания готового пакета приложенияMarmalade поддерживает сборку под ARM, x86 или MIPSБинарник приложения (s3e/s86 файл)Код вашего приложенияДругие модули“Marmalade Studio”C/C++ std lib
  • Концепции Marmalade: УпаковкаНативное приложение(.ipa .apk .bar etc.)ВаширесурсыИспользуйте инструмент упаковки чтобы скомпоновать бинарник вашегоприложения, ресурсы и платформенно зависимый загрузчик для каждой изцелевых платформБинарник приложения (s3e/s86 файл)Код вашего приложенияДругие модули“Marmalade Studio”C/C++ std libПлатформ.расширенияГрафика Кросс платформ. APIMarmaladeСистема
  • Упаковка проекта в Marmalade SDKiOSLoaderiOS AppGCC.mkb проектбинарникSConsAndroid AppAndroidLoaderСимуляторBlackBerry AppЗагрузчикBlackBerryИнструментупаковкиMKBIDEMKB – Файл проекта MarmaladeСистема MKB – генерирует рабочийпроект для IDE из MKB файловIDE – Visual Studio или XcodeScons – система сборки проектов безучастия IDEGCC – Типичный компилятор длясборки под ARM, другие компиляторыиспользуются для прочих архитектурБинарник – собранноеприложение, может запускаться всимуляторе или упаковываться дляустройства
  • Ваше приложение: структураОперационная системаПлатформенная реализацияСтандартные APIКод приложения
  • C++ библиотекиLoadImage(constchar* path)libpngPlatformfopenLoadImage(constchar* path)libpngCustom fopenPlatform fopenПроблема: путь к файлу должен меняться взависимости от платформы
  • Подмена функция в std libLoadImageApp Codefopennewlib_opengluefopenOSПоддержка 19 системных вызовов_exitcloseenvironexecveforkfstatgetpidisattykilllinklseekopenreadsbrkstattimesunlinkwaitwriteОшибка линковщика: символ ‘fopen’ определен несколько раз
  • Прелинковка библиотекПеремещаемая линковка• ld –rКонтроль видимости символов• -B reduceВторая линковка к системнымбиблиотекамprelinklinkИсполнимыйфайлКодприложенияlibpngnewlibБиблиотекиприложенияПлатформенныебиблиотекиСистемныебибилотеки
  • Отделяем бинарник• Бинарник приложенияполностью платформеннонезависим• Подключается кплаформеннымбиблиотекам на этапевыполнения• Виртуальное окружение бездополнительных затратпроизводительностиЗагрузчикДинамическаяподгрузкакодаБиблиотекаприложения
  • Динамическая загрузка кодаБинарник формата ELF(Executable and LinkableFormat)Global offsettableProcedurelinkage table.dysym .dynstr
  • Richer apps areMarmalade200 St. John Street,London, EC1V 4RNUnited Kingdome: bizdev@marmalademail.comwww.madewithmarmalade.com