Jump to content
danieledel

THostName delphi seattle

Recommended Posts

hi I'm moving from the 2010 version to the seattle version to 
compile all my 64 bit programs. In the old sources I used I had a sockets.pas file where the 3 classes below are in it. 
If you fill it up to 32bit no problem at 64 the thostname and tsocketprotocol entry does not see them what can I do?

 

    class function LookupHostAddr(const hostName: PAnsiChar): THostName;
    class function LookupPort(const serviceName: PAnsiChar; potrocolNumber: PAnsiChar = nil): word;
    class function LookupProtocol(const protocolName: PAnsiChar): TSocketProtocol;

 

 

Sockets.pas

Share this post


Link to post

That Sockets unit is OLD (dating back to Delphi 6) and is not maintained.  That unit was Borland's (before Embarcadero owned Delphi) attempt at providing cross-platform socket classes for Kylix, but it doesn't work very well, and they decided to drop it in favor of Indy in later versions.  In fact, that unit is not even distributed with Delphi anymore, XE was the last version to include it.  And even if it were still distributed, the 3 class functions you mention never existed in it, not even in 2010, they were always non-static methods of the TIpSocket class, so you could never call them as standalone functions.

 

I'm not quite sure what you are asking for, but you should not be using that Sockets unit in modern projects at all.

Share this post


Link to post
Posted (edited)
quindi dovrei cambiare tutto in indy?
I'll explain.
I have a dll that inside the project there is an ibconnectionhelper file
and a pcconnectionhelper file the latter has these calls inside and compiling at 64bit does not work.

the file pcconnectionhelper 

i can't get it to work with delphi seattle at 64bit compile

PCConnectionHelper.pas

IBConnectionHelper.pas

Edited by danieledel

Share this post


Link to post
Posted (edited)

The code you have presented does not actually use ANY real functionality from the Sockets unit AT ALL.  It is actually using functionality from the WinSock unit instead.  So you can just remove the Sockets unit completely, you don't have to replace it with anything.  The ONLY things you need to replace are the TSocketHost and TSocketProtocol types.  Those are very easy to replace, just re-define them directly in the PCConnectionHelper unit, eg:

type
  TSocketHost = type AnsiString;
  TSocketProtocol = Word;

Or, just drop them completely, they are not actually needed.  PCConnectionHelper should just use AnsiString and Word as-is instead.

 

That being said, I do see a number of other problems in your code, particularly in the PCConnectionHelper unit, it is using some unsafe pointer operations that can be made simpler and safer.  Maybe that is causing your 64bit issue?  But there are some other issues in the IBConnectionHelper unit too, most notably Ansi vs Unicode mismatches.

 

Try these files instead:

PCConnectionHelper.pas

IBConnectionHelper.pas

Edited by Remy Lebeau

Share this post


Link to post
Posted (edited)

Hi... 

 

I made the changes you indicated. Now I compile the DLL but in error loading phase. Could not load dll.

 

    DLL_Handle := LoadLibrary(DLL_Name);
    if (DLL_Handle=0) or (DLL_Handle=Hinstance_Error) then
      MessageDlg('Caricamento della libreria "'+DLL_Name+'" non riuscito',mtError,[mbAbort],0);

 

32 bit ok.  64 bit no..
 

Edited by danieledel

Share this post


Link to post
Posted (edited)

LoadLibrary() will not return anything other than 0 on failure, so if Hinstance_Error is not 0 then checking for it is wrong.

 

When LoadLibrary() does fail, what does GetLastError() say about WHY it failed?

Edited by Remy Lebeau

Share this post


Link to post

getlasterror 

returns 193 how do I see all the dependencies of my dll? maybe it has something 32bit

Share this post


Link to post

Do you get error 193 in your 64-bit application?
Is the DLL 64-bit?

 

Share this post


Link to post
it was compiled at 64 bit and is executed by a 64bit exe but at loadlibray by error.
can I see if it has 32-bit dependencies?

Share this post


Link to post

Does the DLL itself try to load a second DLL which cannot be found or is the wrong bit-ness?

Share this post


Link to post

Hello. thank you all for the answers.
Just to avoid problems I have compiled all the 64 bit dll.
I partially managed to move forward.
My application connects with firebird 2.1 64 bit meter before it was 32bit. I use the Bcrypt.dll Dll which I suppose is 32bit and I have not found a 64bit reference, removing this dll it goes on but it goes in error because it looks for gds32.dll of firebird that is actually present in the system but it doesn't load it .. I can go on I'm still looking for the solution ....

 

Thanks...

Share this post


Link to post

I'm using this call

  gdsLib: = GetGDSLibrary ('IBSERVER');

is it correct for firebird? it might be this one looking for gds32.dll

Share this post


Link to post

I use IBX components to connect to Firebird. In 64-bit version of my application, it loads client library from ibclient64.dll (it is defined in IBX.IBHeader.pas). Client library must be 64-bit. Client library may need other DLLs (such as MSVCR100.dll...).

Share this post


Link to post
Posted (edited)

Hello everyone. unfortunately I have a bit of difficulty in solving the problem .. I use the ibconnectionhelper where I think I am going to look for the firebird gds32.dll but even if it is present in the system it does not load it.
I wanted to know if there was a way not to use the gds32.dll but the fbclient.dll which is 64 bit ..
my ERP that I'm trying to switch to 64bit practically has this input dll for the connection that all the exes of the program use. Starting a 64bit exe I can't load the dll ... can you give me some advice? do you need to see the source?

 

I think we should change the ibconnectionhelper file but I don't know how ....
not considering that I have another error for the bcrypt.dll dll which I think is also this 32bit

Edited by danieledel

Share this post


Link to post

You can download the latest FB 3.0.5. Download the 64-bit zip. You'll find the fbclient.dll and the two msvc dlls that fbclient.dll depends on.

You can put them together with your exe and it should load that client library.

 

If you need the latest clients for 32-bit (just to have everything in it's place) download the 32-bit zip and copy the same files.

 

Regardning "gdsLib: = GetGDSLibrary ('IBSERVER');" i don't know what that is. There's a path you can set in your exe to point to specific client dll files. I have not tested this with dlls though.

 

HTH,

 

/Dany

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×