Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Lazarus, FreePascal, Kylix, etc. (https://www.clubdelphi.com/foros/forumdisplay.php?f=14)
-   -   simplesftp.pas portado a linux (https://www.clubdelphi.com/foros/showthread.php?t=89093)

anubis 25-09-2015 02:54:54

simplesftp.pas portado a linux
 
Buenas amigos,

Aqui ando peleando de nuevo :(.

Tengo una aplicacion en lazarus para enviar o descargar archivos de un sftp que funciona bien en windows pero no soy capaz de exportarlo a linux :(.

Lo primero que recomendaban era quitar la unit windows (obvio) y luego cambiar winsock por synsock.

De ahi el unico problema que daba era la funcion copymemory, que tambien se soluciona:

Código Delphi [-]
procedure CopyMemory(Destination:PVOID; Source:pointer; Length:DWORD);
begin
  Move(Source^, Destination^, Length);
end;

El problema surge con PVOID que no existe y no encuento forma de, o bien meter una unit que pueda contenerla o bien cambiar por algo que si sirva.

Alguna idea amigos?.

gracias a todos

dec 25-09-2015 09:11:08

Hola,

Tomado de aquí: http://www.angelfire.com/hi5/delphizeus/lifts.html

Cita:

VOID, PVOID, LPVOID, What is a Void?

You will see the VOID in a parameter or Return (Result) of an API function. There is no Pascal substitute for VOID, it roughly means "Nothing is here". The API says this about it - The base type VOID indicates a procedure with no arguments or a function that does not return a result value (a procedure in Pascal).

The pointer types of PVOID, LPVOID and LPCVOID are for the C-Code Non-Typed pointers, which is the Delphi Pascal Pointer type (non-typed pointer).

Let's look at the API definition for the ZeroMemory( ) function -

Código:

VOID ZeroMemory(
  PVOID Destination,
  DWORD Length 
  );

and the windows.pas Pascal definition -

Código Delphi [-]
procedure ZeroMemory(
   Destination: Pointer;
   Length: Cardinal
   );

In Pascal this function becomes a Procedure, because the Return in C-Code is VOID. And the "Destination" is a Pascal "Pointer" type.

Según lo entiendo puedes usar "Pointer" o definir "PVOID" como tal.

anubis 25-09-2015 18:14:50

Gracias por la, respuesta. En cuanto pueda lo checo


La franja horaria es GMT +2. Ahora son las 16:32:47.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi