Size: a a a

Android NDK (C++) — русскоговорящее сообщество

2020 April 29

AT

Arkadi Tolkun in Android NDK (C++) — русскоговорящее сообщество
Matthew Good
even if the files are in the same command (g++ a.cpp b.c) ? eg is it not smart enough to automatically extern "C" any referenced C functions belonging to C files, in C++ files?
с++ can have functions with same name but different parameters. c - can not. So symbols that used to resolve this are different. That's why extern "C" function is not the same as c++ function with same name and parameters. Tecnically they have different symbol names.
источник

MG

Matthew Good in Android NDK (C++) — русскоговорящее сообщество
eg

a.cpp
extern int x();
int main() {
   return x();
}

b.c
int x() {
   return 5;
}

g++ a.cpp b.cpp

a.cpp
-> extern int x();
-> find int x();
-> found in b.c
-> rename line to extern "C" int x();
-> resume compilation
a.cpp -> a.cpp.o
b.c -> b.c.o
a.cpp.o b.c.o -> a.out
источник

AT

Arkadi Tolkun in Android NDK (C++) — русскоговорящее сообщество
a.cpp and b.c  - this is different units. Compiler does not know anything about unit "b.c" while it compiles unit "a.cpp"...
источник

MG

Matthew Good in Android NDK (C++) — русскоговорящее сообщество
Arkadi Tolkun
a.cpp and b.c  - this is different units. Compiler does not know anything about unit "b.c" while it compiles unit "a.cpp"...
x.x
источник

AT

Arkadi Tolkun in Android NDK (C++) — русскоговорящее сообщество
extern int x(); -  this tells compiler that some other unit will have c++ function with name "x" and no parameters. So if you will not provide it - linking will fail.
источник

MG

Matthew Good in Android NDK (C++) — русскоговорящее сообщество
cant it search through the compilation units after preprocessing is done for all files?
источник

MG

Matthew Good in Android NDK (C++) — русскоговорящее сообщество
eg
preprocess a.cpp
preprocess b.c
check a.cpp
check b.c
resume compilation
источник

AT

Arkadi Tolkun in Android NDK (C++) — русскоговорящее сообщество
write your own compiler and build system that can do this mess 🙂
источник

MG

Matthew Good in Android NDK (C++) — русскоговорящее сообщество
rip
источник

I

Ivansuper in Android NDK (C++) — русскоговорящее сообщество
Matthew Good
x.x
There are two stages. First is pretty much isolated translation unit compilation, and the second one is linkage. Linkage is where you get all sorts of OH MY GOD FUNCTION IS UNDEFINED errors
источник

MG

Matthew Good in Android NDK (C++) — русскоговорящее сообщество
ok
источник

MG

Matthew Good in Android NDK (C++) — русскоговорящее сообщество
anyone work with AIDL
источник

AT

Arkadi Tolkun in Android NDK (C++) — русскоговорящее сообщество
what is the question about AIDL ?
источник

AT

Arkadi Tolkun in Android NDK (C++) — русскоговорящее сообщество
same as in java "import ..."
источник

MG

Matthew Good in Android NDK (C++) — русскоговорящее сообщество
/Users/mac/StudioProjects/alpine-term/alpine-term-app/app/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out/alpine/term/TerminalControllerServiceInterface.java:59: error: incompatible types: List<TerminalSessionInterface> cannot be converted to List<IBinder>
reply.writeBinderList(_result);
                     ^
источник

MG

Matthew Good in Android NDK (C++) — русскоговорящее сообщество
interface TerminalSessionInterface {}


import alpine.term.TerminalSessionInterface;
import java.util.List;
interface TerminalControllerServiceInterface {
   List<TerminalSessionInterface> getSessions(); // { return mTerminalSessions; }
}
источник

MG

Matthew Good in Android NDK (C++) — русскоговорящее сообщество
how would i fix that?
источник

AT

Arkadi Tolkun in Android NDK (C++) — русскоговорящее сообщество
this is not good design for AIDL. You can send and recive objects of common types (like int, String, Bool etc) and objects that implemets Parcelable interface.
источник

MG

Matthew Good in Android NDK (C++) — русскоговорящее сообщество
does List implement Parcelable?
источник

AT

Arkadi Tolkun in Android NDK (C++) — русскоговорящее сообщество
источник