[fpc-pascal] Import Pascal record function to C

Marco van de Voort marcov at stack.nl
Mon Oct 31 11:58:22 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.

Runtime library initialising might also be a problem if the DLL uses complex
stuff internally?



More information about the fpc-pascal mailing list