Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifdef __cplusplus
- extern "C"
- #endif
- void show_the_world(void);
- #include <iostream>
- #include "stw.h"
- using namespace std;
- extern "C" void show_the_world() {
- cout << "Hello, world!n";
- }
- $ g++ -c stw.cpp -o stw.cpp -O0 -g
- $ ar rcs stw.a stw.o
- #include "stw.h"
- int main() {
- show_the_world();
- return 0;
- }
- $ gcc -o myapp myapp.c stw.a -lstdc++ -g -O0
- $ ./myapp
- Hello, world!
- $
- #ifndef HEADER_GUARD_1_H
- #define HEADER_GUARD_1_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- // Declare C function interface here.
- int myFunc(int x,char*);
- #ifdef __cplusplus
- }
- #endif
- #endif
Add Comment
Please, Sign In to add comment