Hi Phil.
DOnw't know if you're still at hand.
I got a little problem trying to build a dll that can be used from .net
I has to do with structures / record.
Do you know a right way to use structure and record to pass to a dll (dll lazarus)?
Pointers dont work very well... or I dont get them right.
Passing a pointer to structure using mashal:
(NewFaborderis a structure like this)
Public Structure FabOrder
Public NumOrder As Int32
Public Material As Int32
Public Numero As Int32
End Structure
BufPtr = Marshal.AllocHGlobal(Marshal.SizeOf(NewFaborder))
Marshal.StructureToPtr(NewFaborder, BufPtr, False)
and using it at dll function:
Function ReceiveOrderAndShowNumOrder(Stringer:PFaborder):PFaborder;stdcall;
begin
Result:=Stringer;
end;
Being:
PFaborder=^TFabOrder;
and
TFabOrder=record
NumOrder:int32;
Material:int32;
Numero:int32;
end;
SHould return same NEWFABORDER.
but even it does not give any error or exception, data is not correct.
Am i confusing something?