Anonymous user
Call a foreign-language function: Difference between revisions
→{{header|Delphi}}: Solution for Delphi
(→{{header|Ruby}}: Add solution using Fiddle.) |
(→{{header|Delphi}}: Solution for Delphi) |
||
Line 167:
free(str2);
}</lang>
=={{header|Delphi}}==
===Importing the function from a shared library===
If you have the function to be called available as a shared library you just do an import of that function using the means as shown for [[Call_a_function_in_a_shared_library#Delphi|calling a function from a shared library]].
===Object Files===
There is limited support for linking a function using an object file. For this to work the object file has to be in Borland Linker compatible format. Trying to use a GCC-created object file doesn't work.
The file first has to be bound to your unit:
<lang delphi>
{$O myhello.obj}
</lang>
The next step is to do an external declaration for the function:
<lang delphi>
procedure Hello(S: PChar); stdcall; external;
</lang>
Afterwards usage of the function is just as with any other function.
=={{header|Factor}}==
|