Hi everyone,
Weird pascal/BCB5++ problem
A pascal file compiles ok under bcb5 but if I generate a lib from the pascal
source
and try to use the Lib in my C++ forms I get errors.
Original Pascal file .pas
declaration
function CreateDIB(fDC:HDC;bmInfo:PBMInfo;iColor:DWord;var
Bits:PLine8;hSection,dwOffset:DWord):HBITMAP; stdcall;
implementation
function CreateDIB; external 'gdi32.dll' name 'CreateDIBSection';
Machne BCB5++ generated header file .h
declarations
extern "C" HBITMAP __stdcall CreateDIB(HDC fDC, PBMInfo bmInfo, unsigned
iColor, PLine8 &Bits, unsigned
hSection, unsigned dwOffset);
#pragma option push -w-inl
inline HBITMAP __stdcall CreateDIB(HDC fDC, PBMInfo bmInfo, unsigned iColor,
PLine8 &Bits, unsigned
hSection, unsigned dwOffset)
{
return CreateDIBSection(fDC, bmInfo, iColor, Bits, hSection, dwOffset);
#pragma option pop
the return CreateDIBSection generates the following errors:
[C++ Error] FastDIB.hpp(350): E2034 Cannot convert 'TBMInfo *' to 'const
tagBITMAPINFO *'
[C++ Error] FastDIB.hpp(350): E2340 Type mismatch in parameter 2 (wanted 'const
tagBITMAPINFO *', got 'TBMInfo *')
[C++ Error] FastDIB.hpp(350): E2034 Cannot convert 'unsigned char *' to 'void *
*'
[C++ Error] FastDIB.hpp(350): E2340 Type mismatch in parameter 4 (wanted 'void
* *', got 'unsigned char *')
[C++ Error] FastDIB.hpp(350): E2034 Cannot convert 'unsigned char *' to 'void *
*'
[C++ Error] FastDIB.hpp(350): E2340 Type mismatch in parameter 5 (wanted 'void
*', got 'unsigned int')
declaration in wingdi.h is
WINGDIAPI HBITMAP WINAPI CreateDIBSection( IN HDC, IN CONST BITMAPINFO *, IN
UINT, OUT VOID **, IN HANDLE, IN DWORD);
which makes it obviuos that I'm passing wrong types/parametrs to the function
My question is why does the same delphi code compiles OK in BCB5
whereas if I try to use the machine generated headers on Buildr C++5 form I
get these errors?
Any thoughts or solution is more than welcome. Thanks in advance
OldMan