Board index » delphi » Calling a C++ subroutine from a Pascal Prog

Calling a C++ subroutine from a Pascal Prog

Is this possible ? If so id appreciate some tips.

I obtained a C subroutine for a special device that I need to use, and
cannot rewrite it.

Any suggestions please email to aa...@hilliardandmunoz.com

 

Re:Calling a C++ subroutine from a Pascal Prog


Quote
Aaron wrote:
> Is this possible ? If so id appreciate some tips.

Yes and no.  C and Pascal use different, non-compatible calling conventions.
C functions can be forced to use Pascal-style calls via the compiler or by
using the "pascal" imperative on a function declaration.  Even after you do
that, though, TP can't resolve external links within the C compiled module,
such as those in the core C runtime library.  This means, you can only use the
absolute simplest code written in C.

Quote
> I obtained a C subroutine for a special device that I need to use, and
> cannot rewrite it.

If it's already compiled and you don't have the source, your best bet will
probably be attempting to rebuild the code in native TP.  If you have the
source, reworking it into TP will be the most feasible approach.

Quote
> Any suggestions please email to aa...@hilliardandmunoz.com

--
Scott Earnest            | SPAM protection in effect. Remove  |
setech@_ix.netcom.com    | "_" as needed for true addresses.  |
earnests@_homenet.lm.com |    UIN:1136443  EFnet:pale_blue    |
sinykal@_{*word*104}space.org  | URL: http://www.netcom.com/~setech |

Other Threads