<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3132" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi, </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV><FONT face=Arial size=2>
<DIV>I'm having a strange issue with the LoadLibrary call in the 64bit beta
version of the free pascal compiler (fpc 2.1.5 with lazarus 0.9.23 beta) -
standard install from the sourceforge download and installed in the default
c:\lazarus directory.</DIV>
<DIV> </DIV>
<DIV>I have written a function in FPC that I have used in Delphi for many many
years with out problem. Ok, here's a simple piece of code</DIV>
<DIV> </DIV>
<DIV>function myfunction(a, var b : dword) : boolean;</DIV>
<DIV>var dllh : cardinal;</DIV>
<DIV> fun : function (a : dword; var b : dword) :
boolean; stdcall;</DIV>
<DIV>begin</DIV>
<DIV> result := false;</DIV>
<DIV> </DIV>
<DIV> dllh := loadlibrary('c:\windows\system32\somelib.dll');</DIV>
<DIV> if dllh <> 0 then</DIV>
<DIV> begin</DIV>
<DIV> fun := nil;</DIV>
<DIV> fun :=
getprocaddress(dllh,'someproc');</DIV>
<DIV> if fun <> nil then result :=
fun(a,b);</DIV>
<DIV> end</DIV>
<DIV> else</DIV>
<DIV> result := false;</DIV>
<DIV>end;</DIV>
<DIV> </DIV>
<DIV>Now here's my problem - very simply if I compile this into a standard
console application it works fine, however, if I compile it into the DLL I am
planing to run it in it fails - the loadlibrary call ALWAYS returns 0x7C370000
which appears to be a memory address rather than a handle - the result is that
the getprocaddress returns an invalid address and fails.</DIV>
<DIV> </DIV>
<DIV>So, why is the loadlibrary call failing (or returning this memory address)
when in a DLL but NOT when it's in a console app.</DIV>
<DIV> </DIV>
<DIV>Any help would be great, as I cannot seem to find an implementation of
GETLASTERROR to pass to SYSERRORMESSAGE to display any error from the OS if
there is one !</DIV>
<DIV> </DIV>
<DIV>Thanks folks</DIV>
<DIV> </DIV>
<DIV>Mark</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><BR>Kind regards</DIV>
<DIV> </DIV>
<DIV>Mark Cook<BR>WBIsoft.COM</DIV>
<DIV> </DIV>
<DIV><BR>Any opinions expressed in this message are those of the individual and
not necessarily the company. This message and any files transmitted with it are
confidential and solely for the use of the intended recipient. If you are not
the intended recipient or the person responsible for delivering to the intended
recipient, be advised that you have received this message in error and that any
use is strictly prohibited. </DIV>
<DIV> </DIV>
<DIV>This email was scanned for viruses when sent, however we advise you to
carry out your own virus check before opening any attachment(s) as we cannot
accept liability for any damage sustained as a result of any software
viruses.</FONT></DIV></BODY></HTML>