[fpc-devel] LoadLibrary fails if called from a DLL

Mark - WBIsoft.COM mark at wbisoft.com
Sun Jul 8 19:15:34 CEST 2007


THanks, one final (i hope) question 

I assume I need to grab the entire folder and recompile it - if so I assume I can compile with FPC itself ????

Mark

  ----- Original Message ----- 
  From: Yury Sidorov 
  To: FPC developers' list 
  Sent: Sunday, July 08, 2007 6:12 PM
  Subject: Re: [fpc-devel] LoadLibrary fails if called from a DLL


  Get sources from svn using this path:
  http://svn.freepascal.org/svn/fpc/branches/fixes_2_2

  I dont know where snapshots can be found.

  Yury.

  ----- Original Message ----- 
  From: Mark - WBIsoft.COM 
  To: FPC developers' list 
  Sent: Sunday, July 08, 2007 8:06 PM
  Subject: Re: [fpc-devel] LoadLibrary fails if called from a DLL


  Thanks,

  can you suggest the best way (ie. the correct url) for me to run with the svn.exe command to get the latest snapshot as I'm unsure where the x86_64 stuff is - esp as it would appear to have vanished from the sourceforge page ?

  What's the current x86_64 snapshot version ?

  Thanks

  Mark

    ----- Original Message ----- 
    From: Yury Sidorov 
    To: FPC developers' list 
    Sent: Sunday, July 08, 2007 6:05 PM
    Subject: Re: [fpc-devel] LoadLibrary fails if called from a DLL


    Hi,

    I fixed DLL related a few weeks ago. You need to get more fresh snapshot and test it.

    Yury.

    ----- Original Message ----- 
    From: Mark - WBIsoft.COM 
    To: FPC developers' list 
    Sent: Sunday, July 08, 2007 7:59 PM
    Subject: Re: [fpc-devel] LoadLibrary fails if called from a DLL


    Hi Yury,

    specifically the file was lazarus-0.9.23-fpc-2.1.5-20070531-win64.exe 

    Hope this helps ?

    Mark

      ----- Original Message ----- 
      From: Yury Sidorov 
      To: FPC developers' list 
      Sent: Sunday, July 08, 2007 5:28 PM
      Subject: Re: [fpc-devel] LoadLibrary fails if called from a DLL


      Hello,

      How old is snapshot you are using?

      Yury Sidorov.

      ----- Original Message ----- 
      From: Mark - WBIsoft.COM 
      To: fpc-devel at lists.freepascal.org 
      Sent: Saturday, July 07, 2007 11:51 AM
      Subject: [fpc-devel] LoadLibrary fails if called from a DLL


      Hi,  

      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.

      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

      function myfunction(a, var b : dword) : boolean;
      var  dllh : cardinal;
            fun : function (a : dword; var b : dword) : boolean; stdcall;
      begin
         result := false;

         dllh := loadlibrary('c:\windows\system32\somelib.dll');
         if dllh <> 0 then
         begin
            fun := nil;
            fun := getprocaddress(dllh,'someproc');
            if fun <> nil then result := fun(a,b);
         end
         else
            result := false;
      end;

      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.

      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.

      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 !

      Thanks folks

      Mark




      Kind regards

      Mark Cook
      WBIsoft.COM


      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. 

      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.


--------------------------------------------------------------------------


      _______________________________________________
      fpc-devel maillist  -  fpc-devel at lists.freepascal.org
      http://lists.freepascal.org/mailman/listinfo/fpc-devel



--------------------------------------------------------------------------


      _______________________________________________
      fpc-devel maillist  -  fpc-devel at lists.freepascal.org
      http://lists.freepascal.org/mailman/listinfo/fpc-devel



--------------------------------------------------------------------------


      No virus found in this incoming message.
      Checked by AVG Free Edition. 
      Version: 7.5.476 / Virus Database: 269.10.2/890 - Release Date: 07/07/2007 15:26



----------------------------------------------------------------------------


    _______________________________________________
    fpc-devel maillist  -  fpc-devel at lists.freepascal.org
    http://lists.freepascal.org/mailman/listinfo/fpc-devel



----------------------------------------------------------------------------


    _______________________________________________
    fpc-devel maillist  -  fpc-devel at lists.freepascal.org
    http://lists.freepascal.org/mailman/listinfo/fpc-devel



----------------------------------------------------------------------------


    No virus found in this incoming message.
    Checked by AVG Free Edition. 
    Version: 7.5.476 / Virus Database: 269.10.2/890 - Release Date: 07/07/2007 15:26



------------------------------------------------------------------------------


  _______________________________________________
  fpc-devel maillist  -  fpc-devel at lists.freepascal.org
  http://lists.freepascal.org/mailman/listinfo/fpc-devel



------------------------------------------------------------------------------


  _______________________________________________
  fpc-devel maillist  -  fpc-devel at lists.freepascal.org
  http://lists.freepascal.org/mailman/listinfo/fpc-devel



------------------------------------------------------------------------------


  No virus found in this incoming message.
  Checked by AVG Free Edition. 
  Version: 7.5.476 / Virus Database: 269.10.2/890 - Release Date: 07/07/2007 15:26
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20070708/71401cc2/attachment.html>


More information about the fpc-devel mailing list