Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

A dll from visual c

Hi,
I have a dll writen in visual c.
Its function parameters are structs (records)
I made equal records in delphi by changing this way
C
struct{
int a
double b
unsignd char c
}
to
delphi
record=
a:smallint;
b:double;
c:byte
end;
The size are same
But I think sending parameter in pascal are c are different.And i have not source of dll to add PASCAL keyword for function
Reversing parameter order will solve my problem or not?

Comments

  • zibadianzibadian Member Posts: 6,349
    : Hi,
    : I have a dll writen in visual c.
    : Its function parameters are structs (records)
    : I made equal records in delphi by changing this way
    : C
    : struct{
    : int a
    : double b
    : unsignd char c
    : }
    : to
    : delphi
    : record=
    : a:smallint;
    : b:double;
    : c:byte
    : end;
    : The size are same
    : But I think sending parameter in pascal are c are different.And i have not source of dll to add PASCAL keyword for function
    : Reversing parameter order will solve my problem or not?
    :
    I don't think that for a record it matters much, because the record type declaration specifies the order in which the fields are listed in the memory. I suggest you just try to call the exported procedure from a small test project and see if the results are, what you expect them to be. In case of an error, try the reverse order.
  • bloodyangelbloodyangel Member Posts: 23
    : Hi,
    : I have a dll writen in visual c.
    : Its function parameters are structs (records)
    : I made equal records in delphi by changing this way
    : C
    : struct{
    : int a
    : double b
    : unsignd char c
    : }
    : to
    : delphi
    : record=
    : a:smallint;
    : b:double;
    : c:byte
    : end;
    : The size are same
    : But I think sending parameter in pascal are c are different.And i have not source of dll to add PASCAL keyword for function
    : Reversing parameter order will solve my problem or not?
    :


    Hi, You can try to add "stdcall" or "cdecl" keywords to function decleration in delph. For example :

    procedure SomeFunction (a, b : somerecord) ; stdcall (or cdecl);


  • delphilorddelphilord Member Posts: 2
    : : Hi,
    : : I have a dll writen in visual c.
    : : Its function parameters are structs (records)
    : : I made equal records in delphi by changing this way
    : : C
    : : struct{
    : : int a
    : : double b
    : : unsignd char c
    : : }
    : : to
    : : delphi
    : : record=
    : : a:smallint;
    : : b:double;
    : : c:byte
    : : end;
    : : The size are same
    : : But I think sending parameter in pascal are c are different.And i have not source of dll to add PASCAL keyword for function
    : : Reversing parameter order will solve my problem or not?
    : :
    :
    :
    : Hi, You can try to add "stdcall" or "cdecl" keywords to function decleration in delph. For example :
    :
    : procedure SomeFunction (a, b : somerecord) ; stdcall (or cdecl);
    :
    :
    :
    Thanks i will try

Sign In or Register to comment.