EliGottlieb
Programmer
I built a COM-like infrastructure (I hate Micrsoft), and typedefed DWORD to be called HSERVER (Handle of Server). Then I wrote 2 functions to encode and decode this handle. I did this all in Delphi. Recently I ported it to C++ Builder and compiled it into a DLL. Now when I call one of my functions from Delphi, the incorrect handle is passed, even though I check the value client-side upon calling the function and it's correct then. Here are the function prototypes:
__declspec(dllexport)
HSERVER _stdcall GetHServer(const IPicOmServer* iServer);
IPicOmServer* _fastcall DecodeHServer(const HSERVER
ServerHandle);
__declspec(dllexport)
IPicOmServer* _stdcall PicOmInitialize(const HSERVER
ServerHandle);
PicOmInitialize() is supposed to decode the passed in handle and then assign the result to a global interface pointer. I don't think it's a problem with the calling convention, because when the client is written in C++ the call works. From any other client language an access violation is raised because you can't decode a bad handle. Please tell me what's wrong. When the library was compiled in Delphi it worked fine.
__declspec(dllexport)
HSERVER _stdcall GetHServer(const IPicOmServer* iServer);
IPicOmServer* _fastcall DecodeHServer(const HSERVER
ServerHandle);
__declspec(dllexport)
IPicOmServer* _stdcall PicOmInitialize(const HSERVER
ServerHandle);
PicOmInitialize() is supposed to decode the passed in handle and then assign the result to a global interface pointer. I don't think it's a problem with the calling convention, because when the client is written in C++ the call works. From any other client language an access violation is raised because you can't decode a bad handle. Please tell me what's wrong. When the library was compiled in Delphi it worked fine.