Article View: comp.lang.pascal.delphi.misc
Article #253Calling DLL's made by VC++ from Delphi 5.0 ?
From: VC-Interfacer
Date: Sat, 18 Mar 2000 00:00
Date: Sat, 18 Mar 2000 00:00
44 lines
2615 bytes
2615 bytes
Calling DLL's made by VC++ from Delphi 5.0 ? The easiest situation, of course, is, if the programmer of the VC++ DLL has put every exported function declaration inside a extern "C" -block and used the stdcall -directive, in which case there should be no problem. However, if the programmer of the DLL made by VC++ hasn't done anything special, but left everything as it is by default, with the assumption, that the calling program would also be made by VC++, then there will very likely be on or more of the following problems: 1. Calling convention: - What is the default calling convention of VC++, and does Delphi support it ? If not, what are the technical details of that calling convention, to make it possible to write some assembler code to resolve the problem ? 2. C++ Name mangling and Case sensitivity: Internal C and C++ names, unlike Delphi's, are case sensitive. What about exported function names? With Delphi 1.0, I would use TDUMP -m CPPDLL.DLL to find out the exported function names. Is this still so with Delphi 5.0 ? 3. If some VC++ functions allocate memory on behalf of the calling program, how is it with malloc and free ? Does VC++'s free( ) need any other parameters than the pointer to free ? (to tell the size of the block to free, like Delphi's FreeMem) Are they just wrappers around windows32's GlobalAlloc and GlobalFree, or do they use a similar, but not compatible, sub-allocator as Delphi does (unless you set the limit for "small" allocation block size so that every allocation gets it's own block directly from GlobalAlloc, which merely disables Delphi's sub-allocator) ? If so, and if the VC++ DLL doesn't include function such as you could call for example vc_free( ), that in turn would call MS-VC++'s free( ), is the only solution (unless the VC++ can be changed), to write a small VC++ DLL including only something like vc_free( ), and does even that work ? please post answers to comp.lang.pascal.delphi.misc, if possible. Thanks !
Technical Details
Message-ID:
<38d302a3.2374378@news.kolumbus.fi>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f894d,dad2f6669ebe10a6,start X-Google-Attributes: gidf894d,public X-Google-Thread: f7a51,dad2f6669ebe10a6,start X-Google-Attributes: gidf7a51,public X-Google-Thread: 10baee,dad2f6669ebe10a6,start X-Google-Attributes: gid10baee,public From: VCInterfacer@cyberspace.nil (VC-Interfacer) Subject: Calling DLL's made by VC++ from Delphi 5.0 ? Date: 2000/03/18 Message-ID: <38d302a3.2374378@news.kolumbus.fi> X-Deja-AN: 599035375 Newsgroups: comp.lang.pascal.delphi.misc,borland.public.delphi,microsoft.public.vc.language