Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #7  
Antiguo 19-02-2004
Avatar de jachguate
jachguate jachguate is offline
Miembro
 
Registrado: may 2003
Ubicación: Guatemala
Posts: 6.254
Poder: 30
jachguate Va por buen camino
Lamento llegar un poco tarde... pero quiero apuntar que si es posible pasar y recibir estructuras (records) en los parámetros de llamadas a rutinas de una DLL escrita en otro lenguaje. Basta con ver las llamadas al API de windows que se hacen desde Delphi.

Lo que hay que tener en cuenta, es el esquema de paso de parámetros (calling convention) que se utilizará. Si las rutinas están escritas en C/C++ yo te recomiendo usar stdcall (verificando que la dll sea construida respetando esta convención).

Cita:
Empezado por La ayuda de delphi
The default calling convention is register, but interfaces shared among modules (especially if they are written in different languages) should declare all methods with stdcall. Use safecall to implement methods of dual interfaces and CORBA interfaces.
For more information about calling conventions, see Calling conventions.
Otro asunto a tener en cuenta... es si los datos en el registro estarán alineados en memoria (una estructura optimizada para su acceso por el CPU) o no. Si los registros no vienen alineados... declarar los tipos como packed record en delphi.

Cita:
Empezado por La ayuda de delphi
When a record type is declared in the {$A+} state (the default), and when the declaration does not include a packed modifier, the type is an unpacked record type, and the fields of the record are aligned for efficient access by the CPU. The alignment is controlled by the type of each field. Every data type has an inherent alignment, which is automatically computed by the compiler. The alignment can be 1, 2, 4, or 8, and represents the byte boundary that a value of the type must be stored on to provide the most efficient access. The table below lists the alignments for all data types.
.

Por último... aunque es algo básico, verificar si los parámetros se están pasando por referencia...

hasta luego.

__________________
Juan Antonio Castillo Hernández (jachguate)
Guía de Estilo | Etiqueta CODE | Búsca antes de preguntar | blog de jachguate

Última edición por jachguate fecha: 19-02-2004 a las 17:48:15.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 10:36:57.


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
Copyright 1996-2007 Club Delphi