64 bits DLL c/c++ interface to Delphi - c++

I have a .h file that I need to translate into Delphi, to call a DLL interface that is written in C/C++.
In 32bit, everything goes well, I can use the DLL with a Delphi app with no issue.
In 64bit, it does not work very well.
I did not write this DLL interface, it comes from a third party that does hardware.
namespace gXusb {
typedef int INTEGER;
typedef short INT16;
typedef unsigned CARDINAL;
typedef unsigned char CARD8;
typedef float REAL;
typedef double LONGREAL;
typedef char CHAR;
typedef unsigned char BOOLEAN;
typedef void * ADDRESS;
struct CCamera;
extern "C" EXPORT_ void __cdecl Enumerate( void (__cdecl *CallbackProc)(CARDINAL) );
extern "C" EXPORT_ CCamera *__cdecl Initialize( CARDINAL Id );
Is Cardinal still 32bit unsigned under 64bit?
I'm not very sure about this way of declaring this function type and what it does with 64bit compilation:
void (__cdecl *CallbackProc)(CARDINAL)
It looks a bit cumbersome.
What puzzles me is this:
typedef unsigned CARDINAL;
I have figured out this is 32bit for a 32bit DLL, but did it stay 32bit under a 64bit DLL?

Something like the following should work fine in both 32bit and 64bit:
unit gXusb;
interface
type
// prefixing types that Delphi already declares...
_INTEGER = Int32;
_INT16 = Int16;
_CARDINAL = UInt32;
CARD8 = UInt8;
_REAL = Single;
LONGREAL = Double;
_CHAR = AnsiChar;
_BOOLEAN = ByteBool;
ADDRESS = Pointer;
CCamera = record end;
PCCamera = ^CCamera;
UsbEnumCallback = procedure(Param: _CARDINAL); cdecl;
procedure Enumerate(Cb: UsbEnumCallback); cdecl;
function Initialize(Id: _CARDINAL): PCCamera; cdecl;
implementation
const
TheDLLName = 'the.dll';
procedure Enumerate; external TheDLLName;
function Initialize; external TheDLLName;
end.
Personally, I would just get rid of any type aliases that are not strictly necessary, use native Delphi types were appropriate, eg:
unit gXusb;
interface
type
CARD8 = UInt8;
CCamera = record end;
PCCamera = ^CCamera;
UsbEnumCallback = procedure(Param: UInt32); cdecl;
procedure Enumerate(Cb: UsbEnumCallback); cdecl;
function Initialize(Id: UInt32): PCCamera; cdecl;
implementation
const
TheDLLName = 'the.dll';
procedure Enumerate; external TheDLLName;
function Initialize; external TheDLLName;
end.

Related

std::map gives typeconversion error, but only when compiling for x86

Using Visual Studio 2017, I have a section of code where I define a std::map that compiles fine in x64 but returns an error when compiled for x86.
The map in question keys on an enum and returns a struct with a descriptor string and some function pointers.
I went through my project settings and confirmed the only difference in my C++ compiler settings between the two is the architecture flag. My best guess is it has something to do with the function pointers in each map entry, since I have other std::maps in this same file containing structs of strings and doubles/floats that all work fine.
The specific error thrown is C2440: Can't convert from type1 to type2, with the text cannot convert from 'initializer list' to std::map<int,PropertyMetaData, std::less<_Kty>, std::allocator<std::pair<const _Kty,_Ty>>>
EDIT:
I made the most compact example I could without any external dependencies. I get no errors in x64 but I get the type conversion error when set to x86:
#include <map>
typedef double(*convertFunc)(int, int, double);
typedef int(*convertFuncD)(int, int, double*,double*,int);
extern "C" {
__declspec(dllexport) double __stdcall Pressure(
int inUnits,
int outUnits,
double inValue
);
__declspec(dllexport) int __stdcall PressureD(
int inUnits,
int outUnits,
double* inValue,
double* outValue,
int n
);
}
//Metadata for each Property
struct PropertyMetaData {
const char desc[20]; //Text description
const convertFunc func; //double conversion function
const convertFuncD funcArrayD; //array double conversion function
};
// Map containing all of the properties and their metadata
typedef std::map<int, PropertyMetaData> PropertiesMap;
const PropertiesMap conversions = {
//Mapping The type of unit (mass, distance, etc.) to the appropriate function
//Enumeration {desc[20], func, arrayfuncD, arrayFuncF }
{ 1, {"Pressure", Pressure, PressureD}},
};
After some more experimenting, it seems to be caused by the __stdcall qualifier. If that's removed, I have no issues with either architecture.
Got it! The problem was the inclusion of __stdcall in the function declaration, or rather the omission of __stdcall in the function pointer type definition. It seems like with certain combinations of architecture, the __stdcall may or may not cause a type conversion error if __stdcall is not also in the pointer type definition. Declaring my function pointer type as follows:
typedef double(__stdcall *convertFunc)(EUnits, EUnits, double);
typedef int(__stdcall *convertFuncD)(EUnits, EUnits, double*,double*,int);
typedef int(__stdcall *convertFuncF)(EUnits, EUnits, float*, float*, int);
resolved the error!

Delphi Access Violation calling a C++ DLL that implements an interface

To import a DLL in Delphi I've written a unit translating a .h file
This DLL allow me to define a procedure to monitor two values and use them in my app.
the original .h file is:
class MyINTERFACE
{
public:
virtual void MonitorProc(int value1, int value2) = 0;
};
extern MY_API MyHANDLE* Init();
extern MY_API UINT InitMonitorProc(MyHANDLE * handle, MyINTERFACE * pMyProc);
and this is my translation:
unit myCdllUnit;
interface
const
TMyHANDLE = DWORD;
MyINTERFACE = class
public
procedure MonitorProc(value1: longint; value2: longint); virtual; cdecl; abstract;
end;
function Init(): TMyHANDLE; cdecl; external 'myCdll.dll';
function InitMonitorProc(handle: TMyHANDLE; pMyProc: MyINTERFACE):DWORD; cdecl; external 'myCdll.dll';
implementation
end.
in my main form I override the MonitorProc (initially only with "inherited" to test the calling)
TMyMonitor = class(MyINTERFACE)
public
procedure MonitorProc(value1: longint; value2: longint); override;
end;
procedure TMyMonitor.MonitorProc(value1: longint; value2: longint);
begin
inherited;
end; <--------------------------- here get an Access Violation
and in my FormCreate I pass an istance to InitMonitorProc
MyMonitor := TMyMonitor.Create;
InitMonitorProc(Handle, MyMonitor);
the DLL is calling correctly but exiting MonitorProc I get an access violation error.
Where am I wrong?

Redefinition of type in different libraries

I get byte redefinition error when I try to compile my application. One is defined in Crypto++ library and the other one in rpcdnr.h of Windows Kit. I tried many things but none worked. Any idea to solve the problem is appreciated.
typedef unsigned char byte;
Thanks
P.S. I'm using Qt on Windows.
Namespaces were created for this reason so to avoid interference between identifiers define them under a namspace:
namespace crypto{
typedef unsigned char byte;
};
namespace rpcndr{
typedef unsigned char byte;
};
int main(){
crypto::byte bValue = 7;
rpcndr::byte bvalue2 = 10;
ret
}

Access C++ function declared without calling convention specified from Delphi

I try to use a DLL whose two functions are:
__declspec(dllexport) LPCWSTR* MW_ListReaders(_ULONG Context, int* NumberOfReaders);
__declspec(dllexport) _ULONG MW_Connect(_ULONG Context, LPCWSTR ReaderName);
For use with Delphi, and for the MW_ListReaders function, I made the following statement
function MW_ListReaders(Context : int64; var NumberOfReaders : integer) : PWideChar; stdcall;
Not knowing much in C ++ and in addition, pointers, I am lost.
How can I use these two functions in Delphi?
Your MW_ListReaders() function is declared incorrectly.
The default calling convention in C/C++ when no calling convention is specified is __cdecl, not __stdcall.
MW_ListReaders() is returning a pointer to a pointer to a wide char (which would be PPWideChar in Delphi), but you have declared it as returning a pointer to a wide char (PWideChar) instead.
ULONG is a 32bit unsigned integer, not a 64bit signed integer.
Try this instead:
function MW_ListReaders(Context: UInt32; var NumberOfReaders: Integer): PPWideChar; cdecl; external 'filename.dll';
function MW_Connect(Context: UInt32; const ReaderName: PWideChar): UInt32; cdecl; external 'filename.dll'
UInt32 was added in Delphi 2009. If you are using an older version, or just for good practice in general, you can (and should) use the ULONG or ULONG32 type (and other types) that is in the Windows unit instead to maintain compatibility with the original C/C++ declarations:
uses
..., Windows;
type
PLPCWSTR = ^LPCWSTR;
function MW_ListReaders(Context: ULONG; var NumberOfReaders: Integer): PLPCWSTR; cdecl; external 'filename.dll';
function MW_Connect(Context: ULONG; ReaderName: LPCWSTR): ULONG; cdecl; external 'filename.dll'
I think that _ULONG corresponds to 32-bit unsigned integer type (at least for MS compilers).
And note using PPWideChar as result type.
Edit: calling convention changed to cdecl, default one, as David Heffernan noticed.
function MW_ListReaders(Context: Cardinal; var NumberOfReaders : integer): PPWideChar; cdecl;
function MW_Connect(Context: Cardinal; ReaderName: PWideChar): Cardinal; cdecl;

Android JNI bridge Toast C++ not working - How to fix it?

I'm trying to solve a little problem with my hpp unit.
I found some examples on the internet showing how to Toast an information on screen with an Android JNI bridge, but it was just in pascal (delphi), so I decided to use the same pas file but with it an hpp file for conversion.
Till now I got it:
#ifndef Android_Jni_ToastHPP
#define Android_Jni_ToastHPP
#pragma delphiheader begin
#pragma option push
#pragma option -w- // All warnings off
#pragma option -Vx // Zero-length empty class member
#pragma pack(push,8)
#include <FMX.Helpers.Android.hpp> // Pascal unit
#include <Androidapi.JNIBridge.hpp> // Pascal unit
#include <Androidapi.JNI.JavaTypes.hpp> // Pascal unit
#include <Androidapi.JNI.GraphicsContentViewText.hpp> // Pascal unit
#include <Androidapi.JNI.Util.hpp> // Pascal unit
#include <Androidapi.JNI.App.hpp> // Pascal unit
#include <FMX.Surfaces.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Android
{
namespace Jni
{
namespace Toast
{
//-- type declarations -------------------------------------------------------
extern DELPHI_PACKAGE Androidapi::Jni::Toast __fastcall Toast(const System::UnicodeString Msg, TToastLength duration);
#pragma pack(pop)
//-- type declarations -------------------------------------------------------
//-- var, const, procedure ---------------------------------------------------
} /* namespace Android */
} /* namespace JNI */
} /* namespace Toast */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_ANDROID_JNI_TOAST)
using namespace Android::Jni::Toast;
#endif
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_ANDROID_JNI)
using namespace Android::Jni;
#endif
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_ANDROID)
using namespace Android;
#endif
#pragma pack(pop)
#pragma option pop
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // Androidapi_Jni_ToastHPP
If you would like to have the pascal unit, here is it:
unit Android.JNI.Toast;
interface
{$IFDEF ANDROID}
uses
Androidapi.JNIBridge,
Androidapi.JNI.JavaTypes,
Androidapi.JNI.GraphicsContentViewText;
{$ENDIF}
{$IFDEF ANDROID}
type
TToastLength = (LongToast, ShortToast);
JToast = interface;
JToastClass = interface(JObjectClass)
['{69E2D233-B9D3-4F3E-B882-474C8E1D50E9}']
{ Property methods }
function _GetLENGTH_LONG: Integer; cdecl;
function _GetLENGTH_SHORT: Integer; cdecl;
{ Methods }
function init(context: JContext): JToast; cdecl; overload;
function makeText(context: JContext; text: JCharSequence; duration: Integer)
: JToast; cdecl;
{ Properties }
property LENGTH_LONG: Integer read _GetLENGTH_LONG;
property LENGTH_SHORT: Integer read _GetLENGTH_SHORT;
end;
[JavaSignature('android/widget/Toast')]
JToast = interface(JObject)
['{FD81CC32-BFBC-4838-8893-9DD01DE47B00}']
{ Methods }
procedure cancel; cdecl;
function getDuration: Integer; cdecl;
function getGravity: Integer; cdecl;
function getHorizontalMargin: Single; cdecl;
function getVerticalMargin: Single; cdecl;
function getView: JView; cdecl;
function getXOffset: Integer; cdecl;
function getYOffset: Integer; cdecl;
procedure setDuration(value: Integer); cdecl;
procedure setGravity(gravity, xOffset, yOffset: Integer); cdecl;
procedure setMargin(horizontalMargin, verticalMargin: Single); cdecl;
procedure setText(s: JCharSequence); cdecl;
procedure setView(view: JView); cdecl;
procedure show; cdecl;
end;
TJToast = class(TJavaGenericImport<JToastClass, JToast>)
end;
procedure Toast(const Msg: string; duration: TToastLength = ShortToast);
{$ENDIF}
implementation
{$IFDEF ANDROID}
uses
FMX.Helpers.Android, Androidapi.Helpers;
procedure Toast(const Msg: string; duration: TToastLength);
var
ToastLength: Integer;
begin
if duration = ShortToast then
ToastLength := TJToast.JavaClass.LENGTH_SHORT
else
ToastLength := TJToast.JavaClass.LENGTH_LONG;
CallInUiThread(
procedure
begin
TJToast.JavaClass.makeText(SharedActivityContext, StrToJCharSequence(Msg),
ToastLength).show
end);
end;
{$ENDIF}
end.
However I get error when compilling using this source...
What con I do?
PS.: I arrived on that state just comparing AppMetthod sources with what I was making...
Log:
Checking project dependencies...
Compiling WebBrowser.cbproj (Debug, Android)
bccaarm command line for "uMain.cpp"
c:\program files (x86)\embarcadero\studio\15.0\bin\bccaarm.exe -cc1 -D _DEBUG -isysroot
C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\android-ndk-r9c\platforms\android-14\arch-arm -idirafter =\usr\include -idirafter
C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\android-ndk-r9c\sources\cxx-stl\gnu-libstdc++\4.8\include -idirafter
C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\android-ndk-r9c\sources\cxx-stl\gnu-libstdc++\4.8\libs\armeabi-v7a\include -idirafter
C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\android-ndk-r9c\sources\android\native_app_glue -I
"C:\Users\Public\Documents\Embarcadero\Studio\15.0\Samples\CPP\Mobile Snippets\WebBrowser" -isystem "c:\program files
(x86)\embarcadero\studio\15.0\include" -isystem "c:\program files (x86)\embarcadero\studio\15.0\include\android\rtl" -isystem "c:\program files
(x86)\embarcadero\studio\15.0\include\android\fmx" -isystem "c:\program files (x86)\embarcadero\studio\15.0\include\android\crtl" -g
-fno-limit-debug-info -fborland-extensions -fborland-auto-refcount -nobuiltininc -nostdsysteminc -triple thumbv7-none-linux-androideabi -emit-obj
-mconstructor-aliases -pic-level 2 -target-abi aapcs-linux -nostdinc++ -fdeprecated-macro -fexceptions -fcxx-exceptions -munwind-tables
-mstackrealign -fno-spell-checking -fno-use-cxa-atexit -main-file-name uMain.cpp -x c++ -std=c++11 -O0 -tU -o .\Android\Debug\uMain.o
-dependency-file .\Android\Debug\uMain.d -MT .\Android\Debug\uMain.o uMain.cpp
[bccaarm Error] Android.JNI.Toast.hpp(36): expected a class or namespace
[bccaarm Error] Android.JNI.Toast.hpp(36): reference to 'Android' is ambiguous
Android.JNI.Toast.hpp(28): candidate found by name lookup is 'Android'
FMX.Helpers.Android.hpp(28): candidate found by name lookup is 'Fmx::Helpers::Android'
[bccaarm Error] Android.JNI.Toast.hpp(36): expected unqualified-id
[bccaarm Error] Android.JNI.Toast.hpp(47): expected a class or namespace
[bccaarm Error] Android.JNI.Toast.hpp(47): reference to 'Android' is ambiguous
Android.JNI.Toast.hpp(28): candidate found by name lookup is 'Android'
FMX.Helpers.Android.hpp(28): candidate found by name lookup is 'Fmx::Helpers::Android'
[bccaarm Error] Android.JNI.Toast.hpp(47): expected namespace name
[bccaarm Error] Android.JNI.Toast.hpp(50): expected a class or namespace
[bccaarm Error] Android.JNI.Toast.hpp(50): reference to 'Android' is ambiguous
Android.JNI.Toast.hpp(28): candidate found by name lookup is 'Android'
FMX.Helpers.Android.hpp(28): candidate found by name lookup is 'Fmx::Helpers::Android'
[bccaarm Error] Android.JNI.Toast.hpp(50): expected namespace name
[bccaarm Error] Android.JNI.Toast.hpp(53): reference to 'Android' is ambiguous
Android.JNI.Toast.hpp(28): candidate found by name lookup is 'Android'
FMX.Helpers.Android.hpp(28): candidate found by name lookup is 'Fmx::Helpers::Android'
[bccaarm Error] uMain.cpp(32): use of undeclared identifier 'Toast'
Failed
Elapsed time: 00:00:05.8
EDIT:
New log file:
[bccaarm Error] Androidapi.JNI.Toast.hpp(36): no type named 'Toast' in namespace 'Androidapi::Jni'
[bccaarm Error] Androidapi.JNI.Toast.hpp(36): expected unqualified-id
[bccaarm Error] uMain.cpp(32): unexpected namespace name 'Toast': expected expression
Failed
Since now, thanks a lot.
The .hpp file is malformed.
None of the public types defined in the interface section of the .pas file are defined in the .hpp file. In particular, the TToastLength enum is missing. And Toast() is declared as a procedure in the .pas file and thus has no return value, but it has an (erroneous) return value in the .hpp file.
Did you (or someone else) create the .hpp file manually? I suspect this is the case, for two noticable reasons:
the Android_JNI_ToastHPP define in the initial #ifndef/#define does not match the Fmx_Helpers_AndroidHPP in the corresponding #endif.
the Delphi compiler always names C++ namespaces for Pascal unit names by uppercasing the first letter and lowercasing the remaining letters, but this .hpp file has an all-uppercase JNI namespace.
The Delphi compiler would not makes those mistakes.
With that said, Android.JNI.Toast.pas should be renamed to Androidapi.JNI.Toast.pas (and the .hpp file renamed and its namespaces updated accordingly) for consistency with Embarcadero's other JNI units (and to match the example in this article). That should also help alleviate the reference to 'Android' is ambiguous errors as well.
I strongly suggest you correct the .pas file, run it through the Delphi compiler once to produce the correct .hpp file, and then use it as-is in your C++ code.
Androidapi.JNI.Toast.pas:
unit Androidapi.JNI.Toast;
interface
{$IFDEF ANDROID}
uses
Androidapi.JNIBridge,
Androidapi.JNI.JavaTypes,
Androidapi.JNI.GraphicsContentViewText;
type
TToastLength = (LongToast, ShortToast);
JToast = interface;
JToastClass = interface(JObjectClass)
['{69E2D233-B9D3-4F3E-B882-474C8E1D50E9}']
{ Property methods }
function _GetLENGTH_LONG: Integer; cdecl;
function _GetLENGTH_SHORT: Integer; cdecl;
{ Methods }
function init(context: JContext): JToast; cdecl; overload;
function makeText(context: JContext; text: JCharSequence; duration: Integer)
: JToast; cdecl;
{ Properties }
property LENGTH_LONG: Integer read _GetLENGTH_LONG;
property LENGTH_SHORT: Integer read _GetLENGTH_SHORT;
end;
[JavaSignature('android/widget/Toast')]
JToast = interface(JObject)
['{FD81CC32-BFBC-4838-8893-9DD01DE47B00}']
{ Methods }
procedure cancel; cdecl;
function getDuration: Integer; cdecl;
function getGravity: Integer; cdecl;
function getHorizontalMargin: Single; cdecl;
function getVerticalMargin: Single; cdecl;
function getView: JView; cdecl;
function getXOffset: Integer; cdecl;
function getYOffset: Integer; cdecl;
procedure setDuration(value: Integer); cdecl;
procedure setGravity(gravity, xOffset, yOffset: Integer); cdecl;
procedure setMargin(horizontalMargin, verticalMargin: Single); cdecl;
procedure setText(s: JCharSequence); cdecl;
procedure setView(view: JView); cdecl;
procedure show; cdecl;
end;
TJToast = class(TJavaGenericImport<JToastClass, JToast>)
end;
procedure Toast(const Msg: string; duration: TToastLength = ShortToast);
{$ENDIF}
implementation
{$IFDEF ANDROID}
uses
FMX.Helpers.Android, Androidapi.Helpers;
procedure Toast(const Msg: string; duration: TToastLength);
var
ToastLength: Integer;
begin
if duration = ShortToast then
ToastLength := TJToast.JavaClass.LENGTH_SHORT
else
ToastLength := TJToast.JavaClass.LENGTH_LONG;
CallInUiThread(
procedure
begin
TJToast.JavaClass.makeText(SharedActivityContext, StrToJCharSequence(Msg),
ToastLength).show
end);
end;
{$ENDIF}
end.
Androidapi.JNI.Toast.hpp:
// CodeGear C++Builder
// Copyright (c) 1995, 2014 by Embarcadero Technologies, Inc.
// All rights reserved
// (DO NOT EDIT: machine generated header) 'Androidapi.JNI.Toast.pas' rev: 28.00 (Android)
#ifndef Androidapi_Jni_ToastHPP
#define Androidapi_Jni_ToastHPP
#pragma delphiheader begin
#pragma option push
#pragma option -w- // All warnings off
#pragma option -Vx // Zero-length empty class member
#pragma pack(push,8)
#include <System.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <Androidapi.JNIBridge.hpp> // Pascal unit
#include <Androidapi.JNI.JavaTypes.hpp> // Pascal unit
#include <Androidapi.JNI.GraphicsContentViewText.hpp> // Pascal unit
#include <System.Rtti.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Androidapi
{
namespace Jni
{
namespace Toast
{
//-- type declarations -------------------------------------------------------
enum DECLSPEC_DENUM TToastLength : unsigned char { LongToast, ShortToast };
__interface JToastClass;
typedef System::DelphiInterface<JToastClass> _di_JToastClass;
__interface JToast;
typedef System::DelphiInterface<JToast> _di_JToast;
__interface INTERFACE_UUID("{69E2D233-B9D3-4F3E-B882-474C8E1D50E9}") JToastClass : public Androidapi::Jni::Javatypes::JObjectClass
{
public:
virtual int __cdecl _GetLENGTH_LONG(void) = 0 ;
virtual int __cdecl _GetLENGTH_SHORT(void) = 0 ;
HIDESBASE virtual _di_JToast __cdecl init(Androidapi::Jni::Graphicscontentviewtext::_di_JContext context) = 0 /* overload */;
virtual _di_JToast __cdecl makeText(Androidapi::Jni::Graphicscontentviewtext::_di_JContext context, Androidapi::Jni::Javatypes::_di_JCharSequence text, int duration) = 0 ;
__property int LENGTH_LONG = {read=_GetLENGTH_LONG};
__property int LENGTH_SHORT = {read=_GetLENGTH_SHORT};
};
__interface INTERFACE_UUID("{FD81CC32-BFBC-4838-8893-9DD01DE47B00}") JToast : public Androidapi::Jni::Javatypes::JObject
{
public:
virtual void __cdecl cancel(void) = 0 ;
virtual int __cdecl getDuration(void) = 0 ;
virtual int __cdecl getGravity(void) = 0 ;
virtual float __cdecl getHorizontalMargin(void) = 0 ;
virtual float __cdecl getVerticalMargin(void) = 0 ;
virtual Androidapi::Jni::Graphicscontentviewtext::_di_JView __cdecl getView(void) = 0 ;
virtual int __cdecl getXOffset(void) = 0 ;
virtual int __cdecl getYOffset(void) = 0 ;
virtual void __cdecl setDuration(int value) = 0 ;
virtual void __cdecl setGravity(int gravity, int xOffset, int yOffset) = 0 ;
virtual void __cdecl setMargin(float horizontalMargin, float verticalMargin) = 0 ;
virtual void __cdecl setText(Androidapi::Jni::Javatypes::_di_JCharSequence s) = 0 ;
virtual void __cdecl setView(Androidapi::Jni::Graphicscontentviewtext::_di_JView view) = 0 ;
virtual void __cdecl show(void) = 0 ;
};
class DELPHICLASS TJToast;
#pragma pack(push,4)
class PASCALIMPLEMENTATION TJToast : public Androidapi::Jnibridge::TJavaGenericImport__2<_di_JToastClass,_di_JToast>
{
typedef Androidapi::Jnibridge::TJavaGenericImport__2<_di_JToastClass,_di_JToast> inherited;
public:
/* TJavaImport.Create */ inline __fastcall TJToast(void * ID, void * ClsID, Androidapi::Jnibridge::TJavaVTable* VTable) : Androidapi::Jnibridge::TJavaGenericImport__2<_di_JToastClass,_di_JToast> (ID, ClsID, VTable) { }
/* TJavaImport.Destroy */ inline __fastcall virtual ~TJToast(void) { }
};
#pragma pack(pop)
//-- var, const, procedure ---------------------------------------------------
extern DELPHI_PACKAGE void __fastcall Toast(const System::UnicodeString Msg, TToastLength duration = (TToastLength)(0x1));
} /* namespace Toast */
} /* namespace Jni */
} /* namespace Androidapi */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_ANDROIDAPI_JNI_TOAST)
using namespace Androidapi::Jni::Toast;
#endif
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_ANDROIDAPI_JNI)
using namespace Androidapi::Jni;
#endif
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_ANDROIDAPI)
using namespace Androidapi;
#endif
#pragma pack(pop)
#pragma option pop
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // Androidapi_Jni_ToastHPP