winapi - Delphi - Calling Win API -
what difference between calling win api in following codes
code #1:
uses winapi.activex; procedure foo(); var pv :pointer; begin cotaskmemfree(pv); end;
code #2:
procedure cotaskmemfree( pv: pointer ); stdcall; external 'ole32.dll'; procedure foo(); var pv :pointer; begin cotaskmemfree(pv); end;
i noticed executable file size of code 1 (161,792 bytes) bigger executable file of code 2 (23,552 bytes). think because of code 1 compile following units.
unit winapi.activex; uses winapi.messages, system.types, winapi.windows;
- is there other advantage of using method used on #code2 ?
- is there risk of doing ?
the difference in size reasons outline. when use unit, executable contain code unit, , dependent units. there various options can use reduce impact, invariably executable size increase when use unit not used.
procedure cotaskmemfree(pv: pointer); stdcall; external 'ole32.dll';
it reasonable define yourself, in manner, , avoid using winapi.activex
. in fact, far better if delphi rtl more granular support such uses. it's quite natural wish access com heap allocation routines, nothing more.
Comments
Post a Comment