Accessing C++ DLL function from Delphi
"quadtech100" <[email protected]>
| Newsgroups | gmane.comp.lang.delphi.programming |
|---|---|
| Message-ID | <[email protected]> |
Hello -
I have been trying to access a function in a C++ DLL without
success. The function is given as:
int get_delay_time();
My current approach is as outlined below. I get a "function not
supported on this system" message at the LoadLibrary step, and "The
specified module could not be found" message at the GetProcAddress
step.
I seem to have this all fouled up. Any suggestions would be most
welcome. Thanks.
-----------------------
var
Form1: TForm1;
DelayTime: function (_get_delay_time:integer):integer cdecl;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var
theHandle:THandle;
begin
theHandle:=LoadLibrary('Module1.DLL');
ShowMessage('LoadLibrary: '+SysErrorMessage(GetLastError));
if theHandle <> 0 then
try
@DelayTime:=GetProcAddress(theHandle,'get_delay_time');
ShowMessage('GetProcAddress: '+SysErrorMessage(GetLastError))
except
ShowMessage('Error 0. theHandle <> 0 ')
end
else
ShowMessage('Error 1. theHandle=0 ');
end;
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Save on Coral Calcium. Get Better Health and
Stronger Bones. Seen on TV
http://www.challengerone.com/t/l.asp?cid-2805&lp=calcium2.asp
http://us.click.yahoo.com/9gf46B/EfUGAA/ySSFAA/i7folB/TM
---------------------------------------------------------------------~->
Delphi Tips & Tutorials...
http://www.delphicollection.com
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
---------------------------------------------------------------
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/