=============== Problem description ====================
Today, my colleague sent me a file asking me to call the function file in android:
The content is:
Content of the call_so.cpp file:
# Pragma pack (1) // very important statement that the memory alignment method affects sizeof () results
# Include <stdio. h>
# Include <time. h>
# Include <stdlib. h>
# Include "operation_tools.h"
# Include "call_so.h"
Char uv_file_name [2, 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 content:
# Ifndef _ CALLSO __
# Define _ CALLSO __
Int uf_call_so_file (LPBYTE InHdib, RECT InArea );
# Endif
Operation_tools.sh content:
# 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;
# 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 LONGLONG;
Typedef unsigned 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;
# Endif
/*
# Ifndef _ NEW _
# Define _ NEW _
// The global new operator is reloaded.
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 _
// The Global delete operator is reloaded.
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. h"
// # Include "control_lgq.h"
# Endif
Call_so.o file cannot be opened...
The problem is how to call the file that I need to call ????
I am a newbie. Please kindly advise.
It is best to have dome ....
============= Solution 1 ======================
This is the c ++ code that android calls ..
Look at this http://cherishlc.iteye.com/blog/1756762
Please advise ,... About calling the so file