SlideShare uma empresa Scribd logo
1 de 12
Baixar para ler offline
DLL Building Blocks 
Yes, we scan… 
http://en.wikipedia.org/wiki/Web_of_Things 
Max Kleiner 
Script: 362_maxon3D_EKON18.TXT
Agenda and Tutorial 
(DLL 32/64 bit) 
2 
http://www.softwareschule.ch/download/maxbox_starter28.pdf 
• Call a DLL 
• Call a DLL+ (Interface, Callback, Events) 
• Build a DLL 
• Recompile a DLL 
• Android NDK and Lazarus 
http://scholz2000.com/ 
136_sysinformation_dll_EKON1.txt 
A Short History of Time 
1991 Application Program 
1995 Application 
1998 Applet 
2010 App 
2015 A (Scholz2000, Android, Arduino, ARM)
DLL Primer •• 
Call: If you want your library to be called from programs compiled with 
other compilers, it is important to specify the correct calling convention. 
•• 
Create: A library can be created just as a program, only it uses the 
library keyword, and it has an exports section. 
•• 
Let's get back to the topic and create a DLL callback function: 
•• 
1. declare a function type 
• 2. the function itself 
• 3. define the DLL reference 
• 4. then implement the function in the client 
• 5. and call the DLL: 
3 
136_sysinformation_dll_EKON1.txt 039_pas_dllcall_EKON2.txt 
070_pas_functionplotter_digital2.txt
CCaallllbbaacckk hhaacckk ssttaacckk 
• 
4 
Callback example in client unit 136_Callback_dll_EKON6.txt 
----------------------------------------------- 
interface... 
1. TCallBackFunction = function(sig: integer):boolean; 
2. function callME(sig: integer):boolean; 
implement... 
3. procedure TestCallBack(myCBFunction: TCallBackFunction); register; 
external('watchcom.dll'); 
4. function callMe(sig: integer): boolean; 
begin 
{whatever you need to do, case of...} 
showmessage('I was called with'+ inttostr(sig)); 
end; 
5. procedure TForm1.Button1Click(sender: TObject); 
begin 
testCallBack(callMe); //subscribe function in DLL 
end;
Create a DLL 
5 
Callback in the DLL 
In the DLL you would also declare a function type and a 
procedure (or function) itself, so use it like this: 
type 
TCallBackFunction = function(sig: integer):boolean; 
procedure TestCallBack(clientFunc: TCallBackFunction); stdcall; 
var sigAlive: boolean; 
begin 
{timer stuff... 
set the signal...} 
if(clientFunc(55)) then sigalive := true; 
end; 
exports TestCallBack;
http://max.kleiner.com/dllplus.htm 
6 
Export an object-reference from a DLL is one approach to get real OO-access 
to a DLL. The DLL must create and return the object, so the client 
gets the methods without encapsulating. 
unit income1; 
interface 
type 
IIncome = class 
public 
function GetIncome(const aNetto: Currency): Currency; 
virtual; abstract; 
procedure SetRate(const aPercent, aYear: integer); 
virtual; abstract; 
function queryDLLInterface(var queryList: TStringList): 
TStringList; virtual; abstract; 
end; 
036_pas_includetest_EKON3.txt 
036_pas_dynlib_EKON4.txt 
036_pas_DLLTesting_EKON5.tx
Solution FPC ELF32 
shared object 
7 
32-bit EXE loads 32-bit DLL, 64-bit EXE loads 64-bit DLL. 
************* Simple Sequence Diagram************** 
Client DLL 
¦ TestCallBack(clientFunc) ¦ 
¦---------------------------------------------->¦ 
¦ clientFunc.callMe(sig ) ¦ 
¦<----------------------------------------------¦ 
¦ ¦ 
¦ true (or something to return) ¦ 
¦---------------------------------------------->¦ 
¦ ¦ 
http://wiki.freepascal.org/Android_Programming 
http://www.softwareschule.ch/examples/440_DLL_Tutor2.txt 
Tutor: http://www.softwareschule.ch/download/maxbox_starter18_3.pdf
Solution NDK 
The NDK is a toolset that allows you to implement parts of your app using 
native-code languages such as C, Pascal, Object Pascal and C++. For certain 
types of apps, this can be helpful so you can reuse existing code libraries 
written in these languages, but most apps do not need the Android NDK. 
Typical good candidates for the NDK are CPU-intensive workloads such as 
game engines, signal processing, physics simulation, and so on. When 
examining whether or not you should develop in native code, think about your 
requirements and see if the Android framework APIs provide the functionality 
that you need. 
You have to use the Android NDK to recompile the library. The ARM 
architecture is completely different from the x86 architecture. The system calls 
are different on Linux and Windows. 
8 
http://www.ntu.edu.sg/home/ehchua/programming/android/android_ndk.html
NDK Need Things 
If you have the src files for the DLL, try recompiling as an ELF32 shared object, then link 
that instead into your Android code (- 
below is a Windows solution): 
set NDK_HOME=C:Androidandroid-ndk-r9c // customize this var for your own location 
set LD_LIBRARY_PATH=%NDK_HOME%platformsandroid-18arch-armusrlib cd 
REM -- TEMPORARILY COPY SOME LIBS COMPILER MAY NEED 
copy %NDK_HOME%platformsandroid-18arch-armusrlibcrtbegin*.o . 
copy %NDK_HOME%platformsandroid-18arch-armusrlibcrtend*.o . 
REM -- GENERATE YOUR OBJ FILE 
%NDK_HOME%toolchainsarm-linux-androideabi-4.8prebuiltwindows-x86_64binarm-linux-androideabi- 
gcc.exe -g -I%NDK_HOME%platforms 
android-18arch-armusrinclude -c -fPIC YourLib.c -o YourLib.o 
REM -- GENERATE SHARED OBJ FROM OBJ FILE 
%NDK_HOME%toolchainsarm-linux-androideabi-4.8prebuiltwindows-x86_64binarm-linux-androideabi- 
gcc.exe -g -L%NDK_HOME%platforms 
android-18arch-armusrlib -shared -o YourLib_so.so YourLib_so.o 
REM -- finally, remove the libraries previously copied to src directory 
del .crtbegin*.o 
del .crtend*.o 
9
Optional: Create <project>/jni/Application.mk. 
Build your native code by running the 'ndk-build' script from your project's directory. 
It is located in the top-level NDK directory: 
cd <project> 
<ndk>/ndk-build 
I discovered that to use the build-ndk script, I don't need a real project. 
I created a folder project, with nothing in it except another folder jni, and put all 
my sources in that folder. 
I then created the Android.mk file and ran the script as described in the ndk docs. 
10 
Here's the general outline of how you work with the NDK tools: 
Place your native sources under <project>/jni/... 
Create <project>/jni/Android.mk to describe your native sources to the NDK 
build system 
http://developer.android.com/sdk/ndk/index.html
Thanks! Links to Blocks 
the source is the code 
http://www.softwareschule.ch/maxbox.htm 
http://sourceforge.net/projects/maxbox 
http://en.wikipedia.org/wiki/Arduino 
http://www.softwareschule.ch/download/webofthings2013.pdf 
Book Patterns konkret 
http://www.amazon.de/Patterns-konkret-Max-Kleiner/dp/3935042469 
maXbox 
https://github.com/maxkleiner/maXbox3/releases 
11 
http://max.kleiner.com/dllplus.htm 
http://www.softwareschule.ch/download/dlldesign_ekon9.pdf 
http://developer.android.com/sdk/ndk/index.html 
http://www.ntu.edu.sg/home/ehchua/programming/android/android_ndk.html
Questions? Code a World 
hack the earth 
12 
Yes, we hack… 
https://github.com/maxkleiner/maXbox3/releases

Mais conteúdo relacionado

Mais procurados

C++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerC++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerAndrey Karpov
 
clWrap: Nonsense free control of your GPU
clWrap: Nonsense free control of your GPUclWrap: Nonsense free control of your GPU
clWrap: Nonsense free control of your GPUJohn Colvin
 
Skiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DSkiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DMithun Hunsur
 
HKG15-207: Advanced Toolchain Usage Part 3
HKG15-207: Advanced Toolchain Usage Part 3HKG15-207: Advanced Toolchain Usage Part 3
HKG15-207: Advanced Toolchain Usage Part 3Linaro
 
С++ without new and delete
С++ without new and deleteС++ without new and delete
С++ without new and deletePlatonov Sergey
 
Tiramisu をちょっと、味見してみました。
Tiramisu をちょっと、味見してみました。Tiramisu をちょっと、味見してみました。
Tiramisu をちょっと、味見してみました。Mr. Vengineer
 
Tensor comprehensions
Tensor comprehensionsTensor comprehensions
Tensor comprehensionsMr. Vengineer
 
Дмитрий Нестерук, Паттерны проектирования в XXI веке
Дмитрий Нестерук, Паттерны проектирования в XXI векеДмитрий Нестерук, Паттерны проектирования в XXI веке
Дмитрий Нестерук, Паттерны проектирования в XXI векеSergey Platonov
 
Exploring the Cryptol Toolset
Exploring the Cryptol ToolsetExploring the Cryptol Toolset
Exploring the Cryptol ToolsetUlisses Costa
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionAndrey Karpov
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionPVS-Studio
 
GPU Programming on CPU - Using C++AMP
GPU Programming on CPU - Using C++AMPGPU Programming on CPU - Using C++AMP
GPU Programming on CPU - Using C++AMPMiller Lee
 
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
Gor Nishanov,  C++ Coroutines – a negative overhead abstractionGor Nishanov,  C++ Coroutines – a negative overhead abstraction
Gor Nishanov, C++ Coroutines – a negative overhead abstractionSergey Platonov
 
C++ 11 Features
C++ 11 FeaturesC++ 11 Features
C++ 11 FeaturesJan Rüegg
 
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...Francesco Casalegno
 
C++ amp on linux
C++ amp on linuxC++ amp on linux
C++ amp on linuxMiller Lee
 
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...David Beazley (Dabeaz LLC)
 

Mais procurados (20)

C++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical ReviewerC++ Code as Seen by a Hypercritical Reviewer
C++ Code as Seen by a Hypercritical Reviewer
 
clWrap: Nonsense free control of your GPU
clWrap: Nonsense free control of your GPUclWrap: Nonsense free control of your GPU
clWrap: Nonsense free control of your GPU
 
Skiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DSkiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in D
 
Summary of C++17 features
Summary of C++17 featuresSummary of C++17 features
Summary of C++17 features
 
HKG15-207: Advanced Toolchain Usage Part 3
HKG15-207: Advanced Toolchain Usage Part 3HKG15-207: Advanced Toolchain Usage Part 3
HKG15-207: Advanced Toolchain Usage Part 3
 
С++ without new and delete
С++ without new and deleteС++ without new and delete
С++ without new and delete
 
Tiramisu をちょっと、味見してみました。
Tiramisu をちょっと、味見してみました。Tiramisu をちょっと、味見してみました。
Tiramisu をちょっと、味見してみました。
 
Tensor comprehensions
Tensor comprehensionsTensor comprehensions
Tensor comprehensions
 
Дмитрий Нестерук, Паттерны проектирования в XXI веке
Дмитрий Нестерук, Паттерны проектирования в XXI векеДмитрий Нестерук, Паттерны проектирования в XXI веке
Дмитрий Нестерук, Паттерны проектирования в XXI веке
 
Exploring the Cryptol Toolset
Exploring the Cryptol ToolsetExploring the Cryptol Toolset
Exploring the Cryptol Toolset
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correction
 
Intel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correctionIntel IPP Samples for Windows - error correction
Intel IPP Samples for Windows - error correction
 
GPU Programming on CPU - Using C++AMP
GPU Programming on CPU - Using C++AMPGPU Programming on CPU - Using C++AMP
GPU Programming on CPU - Using C++AMP
 
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
Gor Nishanov,  C++ Coroutines – a negative overhead abstractionGor Nishanov,  C++ Coroutines – a negative overhead abstraction
Gor Nishanov, C++ Coroutines – a negative overhead abstraction
 
Smart Pointers in C++
Smart Pointers in C++Smart Pointers in C++
Smart Pointers in C++
 
C++ 11 Features
C++ 11 FeaturesC++ 11 Features
C++ 11 Features
 
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
[C++] The Curiously Recurring Template Pattern: Static Polymorphsim and Expre...
 
C++ amp on linux
C++ amp on linuxC++ amp on linux
C++ amp on linux
 
FTD JVM Internals
FTD JVM InternalsFTD JVM Internals
FTD JVM Internals
 
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
 

Semelhante a Build DLLs for Android

Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Paris Android User Group
 
Getting started with the NDK
Getting started with the NDKGetting started with the NDK
Getting started with the NDKKirill Kounik
 
Android on IA devices and Intel Tools
Android on IA devices and Intel ToolsAndroid on IA devices and Intel Tools
Android on IA devices and Intel ToolsXavier Hallade
 
Android ndk - Introduction
Android ndk  - IntroductionAndroid ndk  - Introduction
Android ndk - IntroductionRakesh Jha
 
MattsonTutorialSC14.pptx
MattsonTutorialSC14.pptxMattsonTutorialSC14.pptx
MattsonTutorialSC14.pptxgopikahari7
 
Native Android for Windows Developers
Native Android for Windows DevelopersNative Android for Windows Developers
Native Android for Windows DevelopersYoss Cohen
 
CNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgCNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgSam Bowne
 
Introduction to the Android NDK
Introduction to the Android NDKIntroduction to the Android NDK
Introduction to the Android NDKBeMyApp
 
Advance Android Application Development
Advance Android Application DevelopmentAdvance Android Application Development
Advance Android Application DevelopmentRamesh Prasad
 
01 Introduction to programming
01 Introduction to programming01 Introduction to programming
01 Introduction to programmingmaznabili
 
NDK Programming in Android
NDK Programming in AndroidNDK Programming in Android
NDK Programming in AndroidArvind Devaraj
 
CNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgCNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgSam Bowne
 
Ch 6: The Wild World of Windows
Ch 6: The Wild World of WindowsCh 6: The Wild World of Windows
Ch 6: The Wild World of WindowsSam Bowne
 

Semelhante a Build DLLs for Android (20)

Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014Using the android ndk - DroidCon Paris 2014
Using the android ndk - DroidCon Paris 2014
 
Getting started with the NDK
Getting started with the NDKGetting started with the NDK
Getting started with the NDK
 
Android on IA devices and Intel Tools
Android on IA devices and Intel ToolsAndroid on IA devices and Intel Tools
Android on IA devices and Intel Tools
 
Android ndk - Introduction
Android ndk  - IntroductionAndroid ndk  - Introduction
Android ndk - Introduction
 
Android NDK
Android NDKAndroid NDK
Android NDK
 
Android ndk
Android ndkAndroid ndk
Android ndk
 
MattsonTutorialSC14.pptx
MattsonTutorialSC14.pptxMattsonTutorialSC14.pptx
MattsonTutorialSC14.pptx
 
MattsonTutorialSC14.pdf
MattsonTutorialSC14.pdfMattsonTutorialSC14.pdf
MattsonTutorialSC14.pdf
 
Native Android for Windows Developers
Native Android for Windows DevelopersNative Android for Windows Developers
Native Android for Windows Developers
 
Getting Native with NDK
Getting Native with NDKGetting Native with NDK
Getting Native with NDK
 
01 dll basics
01 dll basics01 dll basics
01 dll basics
 
CNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgCNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbg
 
Introduction to the Android NDK
Introduction to the Android NDKIntroduction to the Android NDK
Introduction to the Android NDK
 
Advance Android Application Development
Advance Android Application DevelopmentAdvance Android Application Development
Advance Android Application Development
 
01 Introduction to programming
01 Introduction to programming01 Introduction to programming
01 Introduction to programming
 
Introduction to Programming Lesson 01
Introduction to Programming Lesson 01Introduction to Programming Lesson 01
Introduction to Programming Lesson 01
 
NDK Programming in Android
NDK Programming in AndroidNDK Programming in Android
NDK Programming in Android
 
CNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbgCNIT 126: 10: Kernel Debugging with WinDbg
CNIT 126: 10: Kernel Debugging with WinDbg
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
Ch 6: The Wild World of Windows
Ch 6: The Wild World of WindowsCh 6: The Wild World of Windows
Ch 6: The Wild World of Windows
 

Mais de Max Kleiner

EKON26_VCL4Python.pdf
EKON26_VCL4Python.pdfEKON26_VCL4Python.pdf
EKON26_VCL4Python.pdfMax Kleiner
 
EKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdfEKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdfMax Kleiner
 
maXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_ImplementmaXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_ImplementMax Kleiner
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Max Kleiner
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4Max Kleiner
 
maXbox Starter87
maXbox Starter87maXbox Starter87
maXbox Starter87Max Kleiner
 
maXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmapmaXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmapMax Kleiner
 
maXbox starter75 object detection
maXbox starter75 object detectionmaXbox starter75 object detection
maXbox starter75 object detectionMax Kleiner
 
BASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data VisualisationBASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data VisualisationMax Kleiner
 
EKON 24 ML_community_edition
EKON 24 ML_community_editionEKON 24 ML_community_edition
EKON 24 ML_community_editionMax Kleiner
 
maxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingmaxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingMax Kleiner
 
EKON 23 Code_review_checklist
EKON 23 Code_review_checklistEKON 23 Code_review_checklist
EKON 23 Code_review_checklistMax Kleiner
 
EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP Max Kleiner
 
EKON 12 Closures Coding
EKON 12 Closures CodingEKON 12 Closures Coding
EKON 12 Closures CodingMax Kleiner
 
NoGUI maXbox Starter70
NoGUI maXbox Starter70NoGUI maXbox Starter70
NoGUI maXbox Starter70Max Kleiner
 
maXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIImaXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIIMax Kleiner
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VIMax Kleiner
 
maXbox starter67 machine learning V
maXbox starter67 machine learning VmaXbox starter67 machine learning V
maXbox starter67 machine learning VMax Kleiner
 
maXbox starter65 machinelearning3
maXbox starter65 machinelearning3maXbox starter65 machinelearning3
maXbox starter65 machinelearning3Max Kleiner
 
EKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_DiagramsEKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_DiagramsMax Kleiner
 

Mais de Max Kleiner (20)

EKON26_VCL4Python.pdf
EKON26_VCL4Python.pdfEKON26_VCL4Python.pdf
EKON26_VCL4Python.pdf
 
EKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdfEKON26_Open_API_Develop2Cloud.pdf
EKON26_Open_API_Develop2Cloud.pdf
 
maXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_ImplementmaXbox_Starter91_SyntheticData_Implement
maXbox_Starter91_SyntheticData_Implement
 
Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475Ekon 25 Python4Delphi_MX475
Ekon 25 Python4Delphi_MX475
 
EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4EKON 25 Python4Delphi_mX4
EKON 25 Python4Delphi_mX4
 
maXbox Starter87
maXbox Starter87maXbox Starter87
maXbox Starter87
 
maXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmapmaXbox Starter78 PortablePixmap
maXbox Starter78 PortablePixmap
 
maXbox starter75 object detection
maXbox starter75 object detectionmaXbox starter75 object detection
maXbox starter75 object detection
 
BASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data VisualisationBASTA 2020 VS Code Data Visualisation
BASTA 2020 VS Code Data Visualisation
 
EKON 24 ML_community_edition
EKON 24 ML_community_editionEKON 24 ML_community_edition
EKON 24 ML_community_edition
 
maxbox starter72 multilanguage coding
maxbox starter72 multilanguage codingmaxbox starter72 multilanguage coding
maxbox starter72 multilanguage coding
 
EKON 23 Code_review_checklist
EKON 23 Code_review_checklistEKON 23 Code_review_checklist
EKON 23 Code_review_checklist
 
EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP EKON 12 Running OpenLDAP
EKON 12 Running OpenLDAP
 
EKON 12 Closures Coding
EKON 12 Closures CodingEKON 12 Closures Coding
EKON 12 Closures Coding
 
NoGUI maXbox Starter70
NoGUI maXbox Starter70NoGUI maXbox Starter70
NoGUI maXbox Starter70
 
maXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VIImaXbox starter69 Machine Learning VII
maXbox starter69 Machine Learning VII
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VI
 
maXbox starter67 machine learning V
maXbox starter67 machine learning VmaXbox starter67 machine learning V
maXbox starter67 machine learning V
 
maXbox starter65 machinelearning3
maXbox starter65 machinelearning3maXbox starter65 machinelearning3
maXbox starter65 machinelearning3
 
EKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_DiagramsEKON22_Overview_Machinelearning_Diagrams
EKON22_Overview_Machinelearning_Diagrams
 

Último

result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 

Último (20)

result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 

Build DLLs for Android

  • 1. DLL Building Blocks Yes, we scan… http://en.wikipedia.org/wiki/Web_of_Things Max Kleiner Script: 362_maxon3D_EKON18.TXT
  • 2. Agenda and Tutorial (DLL 32/64 bit) 2 http://www.softwareschule.ch/download/maxbox_starter28.pdf • Call a DLL • Call a DLL+ (Interface, Callback, Events) • Build a DLL • Recompile a DLL • Android NDK and Lazarus http://scholz2000.com/ 136_sysinformation_dll_EKON1.txt A Short History of Time 1991 Application Program 1995 Application 1998 Applet 2010 App 2015 A (Scholz2000, Android, Arduino, ARM)
  • 3. DLL Primer •• Call: If you want your library to be called from programs compiled with other compilers, it is important to specify the correct calling convention. •• Create: A library can be created just as a program, only it uses the library keyword, and it has an exports section. •• Let's get back to the topic and create a DLL callback function: •• 1. declare a function type • 2. the function itself • 3. define the DLL reference • 4. then implement the function in the client • 5. and call the DLL: 3 136_sysinformation_dll_EKON1.txt 039_pas_dllcall_EKON2.txt 070_pas_functionplotter_digital2.txt
  • 4. CCaallllbbaacckk hhaacckk ssttaacckk • 4 Callback example in client unit 136_Callback_dll_EKON6.txt ----------------------------------------------- interface... 1. TCallBackFunction = function(sig: integer):boolean; 2. function callME(sig: integer):boolean; implement... 3. procedure TestCallBack(myCBFunction: TCallBackFunction); register; external('watchcom.dll'); 4. function callMe(sig: integer): boolean; begin {whatever you need to do, case of...} showmessage('I was called with'+ inttostr(sig)); end; 5. procedure TForm1.Button1Click(sender: TObject); begin testCallBack(callMe); //subscribe function in DLL end;
  • 5. Create a DLL 5 Callback in the DLL In the DLL you would also declare a function type and a procedure (or function) itself, so use it like this: type TCallBackFunction = function(sig: integer):boolean; procedure TestCallBack(clientFunc: TCallBackFunction); stdcall; var sigAlive: boolean; begin {timer stuff... set the signal...} if(clientFunc(55)) then sigalive := true; end; exports TestCallBack;
  • 6. http://max.kleiner.com/dllplus.htm 6 Export an object-reference from a DLL is one approach to get real OO-access to a DLL. The DLL must create and return the object, so the client gets the methods without encapsulating. unit income1; interface type IIncome = class public function GetIncome(const aNetto: Currency): Currency; virtual; abstract; procedure SetRate(const aPercent, aYear: integer); virtual; abstract; function queryDLLInterface(var queryList: TStringList): TStringList; virtual; abstract; end; 036_pas_includetest_EKON3.txt 036_pas_dynlib_EKON4.txt 036_pas_DLLTesting_EKON5.tx
  • 7. Solution FPC ELF32 shared object 7 32-bit EXE loads 32-bit DLL, 64-bit EXE loads 64-bit DLL. ************* Simple Sequence Diagram************** Client DLL ¦ TestCallBack(clientFunc) ¦ ¦---------------------------------------------->¦ ¦ clientFunc.callMe(sig ) ¦ ¦<----------------------------------------------¦ ¦ ¦ ¦ true (or something to return) ¦ ¦---------------------------------------------->¦ ¦ ¦ http://wiki.freepascal.org/Android_Programming http://www.softwareschule.ch/examples/440_DLL_Tutor2.txt Tutor: http://www.softwareschule.ch/download/maxbox_starter18_3.pdf
  • 8. Solution NDK The NDK is a toolset that allows you to implement parts of your app using native-code languages such as C, Pascal, Object Pascal and C++. For certain types of apps, this can be helpful so you can reuse existing code libraries written in these languages, but most apps do not need the Android NDK. Typical good candidates for the NDK are CPU-intensive workloads such as game engines, signal processing, physics simulation, and so on. When examining whether or not you should develop in native code, think about your requirements and see if the Android framework APIs provide the functionality that you need. You have to use the Android NDK to recompile the library. The ARM architecture is completely different from the x86 architecture. The system calls are different on Linux and Windows. 8 http://www.ntu.edu.sg/home/ehchua/programming/android/android_ndk.html
  • 9. NDK Need Things If you have the src files for the DLL, try recompiling as an ELF32 shared object, then link that instead into your Android code (- below is a Windows solution): set NDK_HOME=C:Androidandroid-ndk-r9c // customize this var for your own location set LD_LIBRARY_PATH=%NDK_HOME%platformsandroid-18arch-armusrlib cd REM -- TEMPORARILY COPY SOME LIBS COMPILER MAY NEED copy %NDK_HOME%platformsandroid-18arch-armusrlibcrtbegin*.o . copy %NDK_HOME%platformsandroid-18arch-armusrlibcrtend*.o . REM -- GENERATE YOUR OBJ FILE %NDK_HOME%toolchainsarm-linux-androideabi-4.8prebuiltwindows-x86_64binarm-linux-androideabi- gcc.exe -g -I%NDK_HOME%platforms android-18arch-armusrinclude -c -fPIC YourLib.c -o YourLib.o REM -- GENERATE SHARED OBJ FROM OBJ FILE %NDK_HOME%toolchainsarm-linux-androideabi-4.8prebuiltwindows-x86_64binarm-linux-androideabi- gcc.exe -g -L%NDK_HOME%platforms android-18arch-armusrlib -shared -o YourLib_so.so YourLib_so.o REM -- finally, remove the libraries previously copied to src directory del .crtbegin*.o del .crtend*.o 9
  • 10. Optional: Create <project>/jni/Application.mk. Build your native code by running the 'ndk-build' script from your project's directory. It is located in the top-level NDK directory: cd <project> <ndk>/ndk-build I discovered that to use the build-ndk script, I don't need a real project. I created a folder project, with nothing in it except another folder jni, and put all my sources in that folder. I then created the Android.mk file and ran the script as described in the ndk docs. 10 Here's the general outline of how you work with the NDK tools: Place your native sources under <project>/jni/... Create <project>/jni/Android.mk to describe your native sources to the NDK build system http://developer.android.com/sdk/ndk/index.html
  • 11. Thanks! Links to Blocks the source is the code http://www.softwareschule.ch/maxbox.htm http://sourceforge.net/projects/maxbox http://en.wikipedia.org/wiki/Arduino http://www.softwareschule.ch/download/webofthings2013.pdf Book Patterns konkret http://www.amazon.de/Patterns-konkret-Max-Kleiner/dp/3935042469 maXbox https://github.com/maxkleiner/maXbox3/releases 11 http://max.kleiner.com/dllplus.htm http://www.softwareschule.ch/download/dlldesign_ekon9.pdf http://developer.android.com/sdk/ndk/index.html http://www.ntu.edu.sg/home/ehchua/programming/android/android_ndk.html
  • 12. Questions? Code a World hack the earth 12 Yes, we hack… https://github.com/maxkleiner/maXbox3/releases