============问题描述============
今天同事给我发来一个文件,说让我通过android调用里面的函数文件是: 里面的内容是: call_so.cpp文件的内容: #pragma pack(1) //非常重要的申明,内存对齐的方法,影响sizeof()的结果 #include <stdio.h> #include <time.h> #include <stdlib.h> #include "operation_tools.h" #include "call_so.h" char uv_file_name[1024]; int uv_class_type = 1; int uf_call_so_file(LPBYTE InHdib,RECT InArea) { printf("InArea.left=%ld,right=%ld,top=%ld,bottom=%ld\r\n",InArea.left,InArea.right,InArea.top,InArea.bottom); return 1; } call_so.h的内容: #ifndef __CALLSO__ #define __CALLSO__ int uf_call_so_file(LPBYTE InHdib,RECT InArea); #endif operation_tools.sh的内容: #ifndef __OPERATIONTOOLS__ #define __OPERATIONTOOLS__ #include <sys/stat.h> #include <new> #include <iostream> #include <cstdlib> #include <math.h> using namespace std; typedef unsigned long DWORD; typedef int BOOL; typedef unsigned char BYTE; typedef unsigned short WORD; typedef float FLOAT; //typedef DWORD far* LPDWORD; typedef DWORD *LPDWORD; typedef unsigned char * LPBYTE; typedef int INT; typedef unsigned int UINT; typedef unsigned int *PUINT; typedef long LONG; #define pthread_t HANDLE #define pthread_mutex_t HANDLE #define pthread_cond_t HANDLE typedef void *HANDLE; typedef HANDLE HLOCAL; typedef LPBYTE HDIB; #define LPSTR char* #include <memory.h> #include <string.h> #ifndef _RECT_ #define _RECT_ struct _RECT { long left; long top; long right; long bottom; } ; #ifndef _DECLARE_MAXVALUE #define _DECLARE_MAXVALUE typedef struct { int Value; int Dist; double AngleNumber; }MaxValue; #endif typedef _RECT RECT; #define LMEM_MOVEABLE 0x0002 #define LMEM_ZEROINIT 0x0040 #define LHND (LMEM_MOVEABLE | LMEM_ZEROINIT) /* typedef int BOOL; typedef unsigned char BYTE; typedef float FLOAT; typedef FLOAT *PFLOAT; typedef char CHAR; typedef unsigned char UCHAR; typedef unsigned char *PUCHAR; typedef short SHORT; typedef unsigned short USHORT; typedef unsigned short *PUSHORT; typedef long LONG; typedef unsigned short WORD; typedef unsigned long DWORD; typedef long long LONGLONG; typedef unsigned long long ULONGLONG; typedef ULONGLONG *PULONGLONG; typedef unsigned long ULONG; typedef int INT; typedef unsigned int UINT; typedef unsigned int *PUINT; typedef void VOID; typedef char *LPSTR; typedef const char *LPCSTR; typedef wchar_t WCHAR; typedef WCHAR *LPWSTR; typedef const WCHAR *LPCWSTR; typedef DWORD *LPDWORD; typedef unsigned long UINT_PTR; typedef UINT_PTR SIZE_T; typedef LONGLONG USN; typedef BYTE BOOLEAN; typedef void *PVOID; typedef struct _FILETIME { DWORD dwLowDateTime; DWORD dwHighDateTime; } FILETIME; typedef union _ULARGE_INTEGER { struct { DWORD LowPart; DWORD HighPart; }; struct { DWORD LowPart; DWORD HighPart; } u; ULONGLONG QuadPart; } ULARGE_INTEGER, *PULARGE_INTEGER; */ #endif #ifndef _POINT_ #define _POINT_ struct _POINT { int x; int y; }; typedef _POINT POINT; #endif /* #ifndef _NEW_ #define _NEW_ // 重载了全局的new操作符 void* operator new (unsigned int size) { cout << "::new" << endl; cout << size << endl; if(!size) size = 1; void *mem = malloc(size); cout << mem << endl; return mem; } #endif #ifndef _DELETE_ #define _DELETE_ // 重载了全局的delete操作符 void operator delete (void *ptr) { cout << "::delete" << endl; cout << ptr << endl; if(!ptr) return; free(ptr); } #endif */ //#include "cstring_linux/cstring.h" //#include "../../sdk/inc_all/L999_struct.h" //#include "../../sdk/inc_all/wb_struct.h" //#include "../MYJC/MYJC.h" //#include "control_lgq.h" #endif call_so.o的文件点不开。。。 问题是我需要调用那个文件,,如何调用???? 本人是新手,求大神们指导 如果有dome最好。。。。============解决方案1============
你这是android调用c++代码。。 看看这个