Guest User

Untitled

a guest
Jun 24th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #include "common.h"
  4. #ifndef MODULE1_H_
  5. #define MODULE1_H_
  6. int init(int option);
  7. int open(char* db, char* username, char* password);
  8. int get(int handler, int date[2], int time[2], int* data, int& rowsize, int& numrows);
  9. int put(int handler, int* data, int& datasize, int& numrows);
  10. int close(int handler);
  11. int finalize();
  12. #endif /* MODULE1_H_ */
  13.  
  14. #include "common.h"
  15. #ifndef MODULE2_H_
  16. #define MODULE2_H_
  17. int get1(int handler, int date, int time, int *data, int& datasize, int& rowsize);
  18. int put1(int handler, int* data, int datasize);
  19. #endif /*MODULE2_H_*/
  20.  
  21. #include "module1.h"
  22. int init(int option) { ... }
  23. int finalize() { ... }
  24. int get(int handler, int date[2], int time[2], int* data, int& rowsize, int& numrows) {
  25. ....
  26. }
  27. ...
  28.  
  29. #include "module1.h"
  30. #include "module2.h"
  31. int get1(int handler, int date, int time, int* data, int rowsize) {
  32. int daterange[2]={date,date};
  33. int timerange[2]={time,time};
  34. int rsize, numrows, result;
  35. result=get(handler, daterange,timerange, data, rsize, numrows);
  36. rowsize=rsize;
  37. if(numrows!=1) printf("Uh oh...n");
  38. return result;
  39. }
  40. ...
  41.  
  42. g++ -o module1.o -c module1.cpp
  43. g++ -o module2.o -c module2.cpp
  44. g++ -fPIC -shared -o library.so module1.o module2.o
  45.  
  46. extern "C" {
  47. #include "my_bits_of_C.h"
  48. }
Add Comment
Please, Sign In to add comment