Lazarus

Programming => General => Topic started by: PsaCrypt on December 11, 2018, 06:03:28 am

Title: Accesing DLL Functions from other languages
Post by: PsaCrypt on December 11, 2018, 06:03:28 am
Hello,

I want to know how to call a DLL external function compiled with different languages than FPC, and storing returned values from called functions into FPC memory variables.  Could I do this?  If yes, Could I do this for getting array returned from called function too?

Thank you.  :-)
Title: Re: Accesing DLL Functions from other languages
Post by: CCRDude on December 11, 2018, 09:32:48 am
Yes, you can.

Either using LoadLibrary and GetProcedureAddress, or by specifying the function and adding external libname. See the Lazarus Wiki (http://"http://wiki.freepascal.org/Lazarus/FPC_Libraries").

And sure, "arrays" can be exchanged. There's a huge range of options to do so, you'll have to understand and implement the way the DLL passes them.
Title: Re: Accesing DLL Functions from other languages
Post by: sash on December 11, 2018, 10:32:30 am
Could I do this for getting array returned from called function too?

Generally yes, but take in account that everything except base (and compatible) types should be passed by pointer.