Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Source to main.c:
- #include <stdio.h>
- extern int foo(void);
- int main(int argc, char** argv)
- {
- (void) foo();
- return 2;
- }
- Source to foo.c:
- #include <stdio.h>
- int foo(void)
- {
- printf("SUCCESS\n");
- }
- I am able to compile both of these files to main.o and foo.o respectively with the Android NDK, and when I link both of these object files together to create an executable, the resulting executable works.
- HOWEVER
- When I link foo.o into a shared library libfoo.so and create an executable from main.o linking with -lfoo, compilation succeeds without warning. When I copy both the resulting executable and the library to my device with adb push and attempt to run the executable, this is what I get:
- # ./test-c-library
- link_image[1995]: failed to link ./test-c-library
- CANNOT LINK EXECUTABLE
- I can supply sanitized command lines for the gcc and ld commands if that would help.
Add Comment
Please, Sign In to add comment