[fpc-pascal] Import Pascal record function to C

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Mon Oct 31 11:56:01 CET 2005

On 10/31/05, L505 <fpc505 at z505.com> wrote:
> If you had a procedure or a function in a Pascal record, and it was a DLL/DSO, could a C
> application import it as a Struct with a pointer to a function in that struct?

Yes, and the other way is also possible. This is done the other way
round when a pascal program calls RegisterClass from the Windows API.
It is sending a structure has a pointer to a function.

The only possible problem I see is if the structure contains numbers
that are smaller then a Integer (smallint, byte, word, etc) ... then
you may have some problems with the alignment of the data.

>From the Win API example I think that if you simple declare a normal
record on both and use it as a parameter it will work.

Felipe Monteiro de Carvalho

More information about the fpc-pascal mailing list