I have an image compiled successfully for a mobile device. I now want to run it on another device. Can I potentially use the compiled binary? I do not care about having all the functionality right now. I just want to call one of the functions in the code and get a response.
Is it possible to add the compiled code as a shared library in a JNI project?
#Alex - Thank.
Your library is built for some runtime, e.g. iOS or Linux or Windows. It cannot run on a different type of system, but usually quite easily runs on another device of the same kind.
Related
I want make a program in c++ but I want also reuse my code to compile it in multiple operating system and architecture reducing the most possible the changes at code. So I must create a gui executable and a logic executable so that:
for executable logic (start from controller if compared to mvc) is sufficient set architecture set istructions (x86, x64 or arm) and operating system (ios, android, Windows, Linux, ...), then recompile my code without make syntax changes;
executable gui that is different at the changing to each operating system (Windows, android, ios, ...),to each architecture set (android and linux are available in arm, x86 and x64) and to each various display size under 15".
To make this I must find a way to allow at the gui executable and at the logic executable to communicate between they...how can I make this? I must use some library? there is a suite of library or library already included that are available for each combination of operating system, language and architecture set?
The goal is reuse the most possible the code of logic and make different code of gui for each combination of operating system and display size (if under 15 inches).
The IDE that I use is Visual Studio 2015 and I don't want use solutions such as .NET framework or virtual machine because I want maximize the use of efficiency of the hardware.
Hope that request is simple to understand.
You have to use some multiplatform GUI library (Qt, wxWidgets and others). And if you really, really want to separate binary file for GUI and logic you'd have to create dynamic library (dll, so, depending on OS).
for the gui components I find them in other ways or implements GUi application with other IDEs, but the most important thing is find a way that is possibly integrated in C++ language and that is usable in all platform, where I can send and receive data from GUI; a thing that is similar at view class in java (with spring for example but also without it, simple implementing model - view controller pattern)...some ideas? pipes in C++ are valid in all the operating system? the shared memory I have read that can give problems changing the architecture from x86 to x64...
I am working on project which is trying to migrate some legacy application running on QNX neutrino operating system to other open source RTOS based on linux.
I have listed all the third party library and device drivers which must be ported and now analyzing design and source code which depends on some special QNX features like QNX IPC MsgSend, MsgReply, MsgSendPulse etc.
I want to know is there any tools which will help me to make a list of all QNX related system calls or functions which is getting used in code from normal user defined functions or functions provided by third party library and C++ library. Since code is written by other organisations we don't know much details about code except how to compiler and how to run it.
Thanks
Please refer link: https://sourceforge.net/projects/simpl/
You don't have direct API calls in linux which are equivalent to MsgSend, MsgReply etc.. but you can achieve it through using existing pipes/POSIX MQs (or) You can install above tgz package (Which is available in https://sourceforge.net/projects/simpl/).
We have developed an application which has so many C++ files. On Linux we were able to execute it.
We have an U-Boot for the MPC8548E based custom board.
Now we decided to go without OS. So, I tried two methods to execute the C++ applications on U-Boot.
1.) Compiled the C++ application with the g++ (C++ cross-compiler) and tried to link with the U-Boot, which is compiled using gcc (The C-Compiler). But I am unable to do that:
The error message I am seeing is:
/ToolChain/host/usr/powerpc-buildroot-linux-uclibcspe/bin/ld: failed to merge target specific data of file...
2.) Tried to compile my application along with U-Boot in the same way the standalone examples are done. I created a separate directory in the U-Boot and tried to compile it. C++ applications are not getting built, but I am able to build C-Applications.
My main intention is to execute C++ applications directly on U-Boot.
Please help me how to do that?
Sorry, I believe it would be more work to get C++ on U-Boot than it would be for you to e.g. go with OS.
The short answer, from U-Boot tech lead:
> Does u-boot support C++ example programs and if so, how can I build one?
U-Boot does not support C++.
Some of the technical background for this: U-Boot runs on bare metal. A U-Boot standalone application would link to U-Boot's exported functions which the application needs. For example, your C++ application would use 'new', your C++ library needs to perform calls to malloc, which in this case would mean going to the u-boot exported function interface (refer to doc/README.standalone).
For the general topic of C++ on bare metal, I have not done that, but found Miro Samek tutorial that may shed light. I think it would be difficult. Porting linux starts to look good in comparison.
I have written and tested a library in C++. The code even works in my Android application if I add the source files directly. While I do have experience compiling static and dynamic libraries for common operating systems, I have zero experience compiling for a mobile system like this. I've done some research, and I'm still a bit lost as to exactly how to approach this. For example, I am unsure of whether to build a makefile for use with ndk-build or to just invoke one of the Android's compilers directly.
I did see this question, but it does not quite match my situation. I just want to run build and have it spit out libfoo.a (I'd like to produce libfoo.so as well, but libfoo.a is of greater interest to me right now.) The example in that question's winning answer implied that it would build the library as one step/module for building the final application. I tried doing it that way just to see, but I had no luck.
Can anyone please guide me in this endeavor?
CLARIFICATION -- I do not want to build the library and immediately pipe it into an application. I want a .a or .so file that I can link against in multiple future Android applications.
Create a dummy java file with empty code and make sure there is a android_main function in your C++ code. Build using ndk-build. the resulting apk will make your library an application.
See the samples from the android-ndk-r5/samples directory, see the sample native-bitmap to get some idea.
If I understand it correctly that a shared library is not acceptable and you want to be static (but why is that so important?), probably the easiest way to do so is to simply supply source code that can be added to a project.
Ultimately there is nothing special about the ndk build system other than it knowing the right commands to issue to build the necessary files for the assortment of curent android architectures. If you really want to do something different, you can log the operation of the android build system in creating a shared library, and then write your own Makefile that performs the analogous steps to create a static library. HOWEVER, you will have to update your Makefile any time the underlying assumptions or target collections change in a new android version.
I want to create a program that modifies another c++ source,compiles it and runs the exe.
I mean with something like gcc may be I can but on a windows os gcc may not be present.
Is it possible?
I think your options are fairly limited for windows:
Check for an install of a compiler (possibly limit this to a short list) and use that compiler
Bring along a compiler in your application's install package
Cowboy answer:
Only if:
the source code doesn't need a lot of files/headers/libraries
they can be easily collected by your application
the application have connection with some server of yours
The application could:
collect the files in a zip
send them over the wire to an compiler service (accesible vía HTTP)
the server compile it with its own installation
and return the binary executable inside the response.
Of course: it depends on so many variables that seems not very feasible. And the zip+http thing could be difficult from a C/C++ app.