Page 3 of 3

Re: CardReader

Posted: Tue Dec 11, 2012 12:51 pm
by srvet_claudio
Hola Daniel.

Sí a nivel de C es fácil pasar por referencia un parámetro.

El problema es que CallDll32() es una función nativa de HMG a nivel PRG que a su vez llama otra función nativa de HMG a nivel C, las cuales no están diseñadas para aceptar parámetros por referencia.

Un abrazo,
Claudio.

Re: CardReader

Posted: Tue Dec 11, 2012 1:06 pm
by danielmaximiliano
srvet_claudio wrote:Hola Daniel.

Sí a nivel de C es fácil pasar por referencia un parámetro.

El problema es que CallDll32() es una función nativa de HMG a nivel PRG que a su vez llama otra función nativa de HMG a nivel C, las cuales no están diseñadas para aceptar parámetros por referencia.

Un abrazo,
Claudio.
Tengo aparte de la DLL (eIDReader.dll) una LIB (eIDReader.lib) pero nose como incluirla y trabajar con ella, pense en transformarla/recompilarla en libeIDReader.a y trabajar como las otras libs de harbour.

tengo el proyecto.SLN para compilar en forma estatica pero nose como hacerlo ya que siempre que quiero compilar con Visual c++ estos tipos de proyectos me dan muchos errores y nose como corregirlos.

Re: CardReader

Posted: Tue Dec 11, 2012 9:44 pm
by danielmaximiliano
srvet_claudio wrote:Hola Daniel.

Sí a nivel de C es fácil pasar por referencia un parámetro.

El problema es que CallDll32() es una función nativa de HMG a nivel PRG que a su vez llama otra función nativa de HMG a nivel C, las cuales no están diseñadas para aceptar parámetros por referencia.

Un abrazo,
Claudio.
una consulta claudio, es posible entonces esto que encontre en Fivetech.

Code: Select all


HB_ISBYREF()
Determine if a variable is passed by reference.
Syntax
HB_ISBYREF( @<Var> ) --> <lVarIsByRef>
Argument(s)
@<Var> is the variable to test; it must be passed by reference.
Returns
<lVarIsByRef> a logical value indicating if the variable is passed by reference to actual function or procedure.
Description
This function return a logical value indicating if the variable is passed by reference to actual function or procedure.
ATTENTION: The variable to test must be passed by reference. If the variable is not passed by reference, the function return NIL. This function is based on the form that Harbour manages to the variables for reference. When a variable is passed by reference, what receives the function or procedure is, a pointer to the previous variable, be this the container variable of the data or a pointer to another variable. The function observes if the variable passed points to a common variable or to a variable passed by reference.
Example(s)

See Tests

Test(s)

function Main()
local cVar := "Test local"
private nVar := 0
Test( @cVar, @nVar, cVar, nVar )
return nil
procedure Test( Arg1, Arg2, Arg3, Arg4 )
? hb_isbyref( @Arg1 )        // .T.
? hb_isbyref( @Arg2 )        // .T.
? hb_isbyref( @Arg3 )        // .F.
? hb_isbyref( @Arg4 )        // .F.
return

Re: CardReader

Posted: Tue Dec 11, 2012 11:40 pm
by srvet_claudio
danielmaximiliano wrote:una consulta claudio, es posible entonces esto que encontre en Fivetech.


Code:

HB_ISBYREF()
Determine if a variable is passed by reference.
Syntax
HB_ISBYREF( @<Var> ) --> <lVarIsByRef>
Argument(s)
@<Var> is the variable to test; it must be passed by reference.
Returns
<lVarIsByRef> a logical value indicating if the variable is passed by reference to actual function or procedure.
Description
This function return a logical value indicating if the variable is passed by reference to actual function or procedure.
ATTENTION: The variable to test must be passed by reference. If the variable is not passed by reference, the function return NIL. This function is based on the form that Harbour manages to the variables for reference. When a variable is passed by reference, what receives the function or procedure is, a pointer to the previous variable, be this the container variable of the data or a pointer to another variable. The function observes if the variable passed points to a common variable or to a variable passed by reference.
Example(s)

See Tests

Test(s)

function Main()
local cVar := "Test local"
private nVar := 0
Test( @cVar, @nVar, cVar, nVar )
return nil
procedure Test( Arg1, Arg2, Arg3, Arg4 )
? hb_isbyref( @Arg1 )        // .T.
? hb_isbyref( @Arg2 )        // .T.
? hb_isbyref( @Arg3 )        // .F.
? hb_isbyref( @Arg4 )        // .F.
return
Daniel no va a funcionar, hb_isbyref() solo informa si una parámetro es o no pasado por referencia.
La única solución es llamar la librería DLL a nivel de C, con la función LoadLibrary() pero para eso necesitas el archivo de cabecera en C (.h) de la librería para poder llamar correctamente las funciones de la DLL.

Re: CardReader

Posted: Wed Dec 12, 2012 12:34 am
by danielmaximiliano
Hola Claudio :

no fui muy especifico al publicar el ejemplo, decia esto
@<Var> is the variable to test; it must be passed by reference.
en este caso HB_ISBYREF determina si la variable es pasado por referencia

Code: Select all

HB_ISBYREF( @<Var> )
gracias por la ayuda/consejos que me esta dando