Re: [fpc-devel] DLL WIN64: Entry point not found

2007-07-19 Thread Mark - WBIsoft.COM

Yury,

just out of curiosity while I'm working on this DLL - with Delphi I can 
change the default image load adress from the DLL from $400 to anything 
I want, is this possible with FPC ?


Mark

- Original Message - 
From: "Yury Sidorov" <[EMAIL PROTECTED]>

To: "FPC developers' list" 
Sent: Thursday, July 19, 2007 3:10 PM
Subject: Re: [fpc-devel] DLL WIN64: Entry point not found



The problem can be caused by relocation.
Try to force a dll to relocate in all cases by using -WB0 command line 
switch.
Then create sample host application using fpc and try to reproduce the 
problem.


Yury.

- Original Message - 
From: "Mark - WBIsoft.COM" <[EMAIL PROTECTED]>

To: "FPC developers' list" 
Sent: Thursday, July 19, 2007 4:58 PM
Subject: Re: [fpc-devel] DLL WIN64: Entry point not found


I am, the only problem is the sample needs to be a complete gina - as it's 
the loading by WINLOGON.EXE that causes it to break !!


- Original Message - 
From: "Yury Sidorov" <[EMAIL PROTECTED]>

To: "FPC developers' list" 
Sent: Thursday, July 19, 2007 2:46 PM
Subject: Re: [fpc-devel] DLL WIN64: Entry point not found



From: "Luc Vigato, Sita Software" <[EMAIL PROTECTED]>

I have downloaded the latest snapshot. The error is thill there.

With the test dll which I have send yesterday it's work fine now, but 
the

finall DLL wich contains over 20 exported function I have an error.


Try to create sample dll which reproduces the problem and submit bug 
report.


Yury. ___
fpc-devel maillist  -  fpc-devel@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.9/907 - Release Date: 18/07/2007 15:30





___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

___
fpc-devel maillist  -  fpc-devel@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.9/907 - Release Date: 18/07/2007 15:30





___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] DLL WIN64: Entry point not found

2007-07-19 Thread Mark - WBIsoft.COM
I am, the only problem is the sample needs to be a complete gina - as it's 
the loading by WINLOGON.EXE that causes it to break !!


- Original Message - 
From: "Yury Sidorov" <[EMAIL PROTECTED]>

To: "FPC developers' list" 
Sent: Thursday, July 19, 2007 2:46 PM
Subject: Re: [fpc-devel] DLL WIN64: Entry point not found



From: "Luc Vigato, Sita Software" <[EMAIL PROTECTED]>

I have downloaded the latest snapshot. The error is thill there.

With the test dll which I have send yesterday it's work fine now, but the
finall DLL wich contains over 20 exported function I have an error.


Try to create sample dll which reproduces the problem and submit bug 
report.


Yury. ___
fpc-devel maillist  -  fpc-devel@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.9/907 - Release Date: 18/07/2007 15:30





___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] DLL WIN64: Entry point not found

2007-07-19 Thread Mark - WBIsoft.COM
I am running that version !  I will try to construct a simple DLL to be 
tested.


Mark



- Original Message - 
From: "Yury Sidorov" <[EMAIL PROTECTED]>

To: "FPC developers' list" 
Sent: Thursday, July 19, 2007 1:51 PM
Subject: Re: [fpc-devel] DLL WIN64: Entry point not found



From: "Mark - WBIsoft.COM" <[EMAIL PROTECTED]>
I had the same behaviour with a WIN64 DLL being loaded by WINLOGON.EXE, it 
fails to work - GetProcAddress calls fail, however, the same DLL  loaded 
by an FPC app worked fine !!!  I'm trying to build a simple demo DLL but 
with Gina replacement it's not that simple !!!


I think there is some issue with the DLL image generated by FPC, just not 
sure what it is yet !?


You need to upgrade to the latest svn version (or download snapshot)
of FPC 2.1.5.
DLL bugs were fixed after 2007/05/31.

Yury Sidorov. ___
fpc-devel maillist  -  fpc-devel@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.9/907 - Release Date: 18/07/2007 15:30





___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] DLL WIN64: Entry point not found

2007-07-19 Thread Mark - WBIsoft.COM
I had the same behaviour with a WIN64 DLL being loaded by WINLOGON.EXE, it 
fails to work - GetProcAddress calls fail, however, the same DLL  loaded by 
an FPC app worked fine !!!  I'm trying to build a simple demo DLL but with 
Gina replacement it's not that simple !!!


I think there is some issue with the DLL image generated by FPC, just not 
sure what it is yet !?


HTH

Mark


- Original Message - 
From: "Luc Vigato, Sita Software" <[EMAIL PROTECTED]>

To: "'FPC developers' list'" 
Sent: Thursday, July 19, 2007 7:14 AM
Subject: RE: [fpc-devel] DLL WIN64: Entry point not found



A host application compiled with fpc don't have this problem.



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] DLL WIN64: Entry point not found

2007-07-18 Thread Mark - WBIsoft.COM

Ok, try the MiTeC EXE explorer from http://www.mitec.cz

I use it for my 64bit windows dll's

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] DLL WIN64: Entry point not found

2007-07-18 Thread Mark - WBIsoft.COM
Wasn't aware CDECL on Win64 was the same as STDCALL, if so then is the 
export table correct - have you checked with a dependancy checker ? 


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] DLL WIN64: Entry point not found

2007-07-18 Thread Mark - WBIsoft.COM

I think the calling convention be STDCALL ?

Mark



- Original Message - 
From: "Luc Vigato, Sita Software" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, July 18, 2007 10:43 AM
Subject: [fpc-devel] DLL WIN64: Entry point not found



Hello,

I have compiled a DLL under Win64. It's a UDF-library for Firbird 2.1.
Under Linux 64bit all things are working, only in WIN64 not.

The problem is that Firebird says that he cannot find the Entry Point of
each of my functions.
It's not a Firebird problem, i have made a test application who calls the
function from the DLL and i have the same error "entry point not found".

Calling convention is: cdecl

Can someone help me please ?

These is my command line to compile the library.

fpc -S2 -Sh -dFREE_IT -Fu../Units SitaUdfLib.dpr


Output of fpc
-
Free Pascal Compiler version 2.1.5 [2007/05/31] for x86_64
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Win64 for x64
Compiling SitaUdfLib.dpr
Compiling UnitFonctionUdfString.pas
Linking SitaUdfLib.dll
977 lines compiled, 0.5 sec, 635888 bytes code, 312064 bytes data
1 note(s) issued


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


___
fpc-devel maillist  -  fpc-devel@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.8/906 - Release Date: 17/07/2007 
18:30





___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


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

2007-07-09 Thread Mark - WBIsoft.COM
Hi Yury,

have now recompiled the DLL with the latest SVN build using the 2_2 fixes but 
get the same problem, load library returns the same hex value 0x7c37000 - the 
actual procedure I have in the DLL is as follows

//  cut code here

function GetModuleHandle(lpModuleName: PCHAR): cardinal; stdcall; external 
'kernel32.dll' name 'GetModuleHandleA';
function LoadLibrary(lpLibFileName: PCHAR): cardinal; stdcall; external 
'kernel32.dll' name 'LoadLibraryA';
function GetProcAddress(hModule: HMODULE; lpProcName: LPCSTR): FARPROC; 
stdcall; external 'kernel32.dll' name 'GetProcAddress';

procedure debug(fn, tx : string);
var f : textfile;
begin
   assignfile(f,'c:\skelgina.log');
   if fileexists('c:\skelgina.log') then
  append(f)
   else
  rewrite(f);
   writeln (f,timetostr(now) + '  -  ' + fn + ': ' + tx);
   writeln (f);
   closefile(f);
end;

procedure GetProcedureAddress(var P: Pointer; const ModuleName, ProcName: 
string); stdcall;
var
  ModuleHandle: cardinal;
begin
  debug('GetProcedureAddress','Called');
  debug('GetProcedureAddress','ModuleName: '+modulename);
  debug('GetProcedureAddress','ProcName: '+procname);

  
  if not Assigned(P) then
  begin
debug('GetProcedureAddress','P is not assigned');
begin
  ModuleHandle := SafeLoadLibrary('MSGINA.DLL');
  debug('GetProcedureAddress','LoadLibrary MSGINA.DLL returns 
$'+inttohex(ModuleHandle,16));
end;
P := Pointer(GetProcAddress(ModuleHandle, PChar(ProcName)));

  end
  else
 debug('GetProcedureAddress','P is already assigned');
  
  debug('GetProcedureAddress','Exits - P assigned '+booltostr(assigned(p)));
end;

//  end code here

Any thoughts on this ?  I pulled the GetProcedureAddress function from the 
Jwa??? components to test incase it was my implementation of the LoadLIbrary 
code in FPC but obviously it's not !!!

Cheers

Mark


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


  Go to sources folder and execute:

  make distclean
  make all
  make install SNAPSHOT=1 INSTALL_PREFIX=C:/some_folder

  Yury.


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


  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@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 strang

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

2007-07-09 Thread Mark - WBIsoft.COM

Yeah, I spooted that with a windows DLL as well !


- Original Message - 
From: "Marco van de Voort" <[EMAIL PROTECTED]>

To: "FPC developers' list" 
Sent: Monday, July 09, 2007 9:22 AM
Subject: Re: [fpc-devel] LoadLibrary fails if called from a DLL


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


(I happened to test a couple of Unix related problems, and the issues are
still there, most notably the initialization sections not being run.

I assume that is not by design?!?)

___
fpc-devel maillist  -  fpc-devel@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@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


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

2007-07-08 Thread Mark - WBIsoft.COM
Thanks for the d/l link. Will install this before I try the svn builds and 
see how we go.


Thanks a lot guys

Mark

- Original Message - 
From: "Vincent Snijders" <[EMAIL PROTECTED]>

To: "FPC developers' list" 
Sent: Sunday, July 08, 2007 6:21 PM
Subject: Re: [fpc-devel] LoadLibrary fails if called from a DLL



On Sun, 08 Jul 2007 20:12:39 +0300
Yury Sidorov <[EMAIL PROTECTED]> wrote:


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.


You can download  a lazarus snapshot for win64 with fpc 2.1.5 (i.e. 
fixes_2_2) from http://www.hu.freepascal.org/lazarus/


Vincent
___
fpc-devel maillist  -  fpc-devel@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@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


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

2007-07-08 Thread Mark - WBIsoft.COM
Thanks :o)
  - Original Message - 
  From: Yury Sidorov 
  To: FPC developers' list 
  Sent: Sunday, July 08, 2007 6:24 PM
  Subject: Re: [fpc-devel] LoadLibrary fails if called from a DLL


  Go to sources folder and execute:

  make distclean
  make all
  make install SNAPSHOT=1 INSTALL_PREFIX=C:/some_folder

  Yury.


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


  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@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 0x7C37 
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 an

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

2007-07-08 Thread Mark - WBIsoft.COM
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@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 0x7C37 
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@lists.freepascal.org
  http://lists.freepascal.org/mailman/listinfo/fpc-devel



--


  ___
  fpc-devel maillist  -  fpc-

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

2007-07-08 Thread Mark - WBIsoft.COM
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@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 0x7C37 
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@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel






___
fpc-devel maillist  -  fpc-devel@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@lists.freepascal.org
  http://lists.freepascal.org/mailman/listinfo/fpc-devel



--


  ___
  fpc-devel maillist  -  fpc-devel@lists.freepascal.org
  http://lists.freepascal.org/mailman/listinfo/fpc-devel




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

2007-07-08 Thread Mark - WBIsoft.COM
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@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 0x7C37 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@lists.freepascal.org
  http://lists.freepascal.org/mailman/listinfo/fpc-devel



--


  ___
  fpc-devel maillist  -  fpc-devel@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@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


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

2007-07-08 Thread Mark - WBIsoft.COM
Hi, it's the sourceforge build I downloaded some weeks ago, havnt checked the 
latest svn build as I'm not sure how to get that into the lazarus ide yet ? 
 Any tips ?

Thanks

  - 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@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 0x7C37 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@lists.freepascal.org
  http://lists.freepascal.org/mailman/listinfo/fpc-devel



--


  ___
  fpc-devel maillist  -  fpc-devel@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@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


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

2007-07-07 Thread Mark - WBIsoft.COM
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 0x7C37 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@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel