Solved

C Code in Delphi ?

Posted on 1997-05-18
3
240 Views
Last Modified: 2010-04-04
Is it possible to include c code within a delphi program. If so please supply an example of a Delphi Program calling a C routine.

thanks

Chris
0
Comment
Question by:chj
3 Comments
 
LVL 1

Expert Comment

by:slp
ID: 1336430
When you say "include c code" do you mean having actual C code embedded in your Delphi/Object Pascal code?  Like:
 
begin
  // start coding in C
  int y ;
  int x = 10 ;
  for y = 2 ; y <= x ; y++ {
  dosomestuff( y ) ; }

  // now back to Pascal
  for a := 1 to 10 do
  begin
    dosomestuff( a ) ;
  end ;
  ...
end ;  

or are you asking if you can call functions written in C that are compiled into other "libraries" (e.g. DLLs, Object Files, etc.)?

A bit more info please.

SLP
 
0
 
LVL 3

Accepted Solution

by:
mheacock earned 100 total points
ID: 1336431
You CANNOT embed C code in a Delphi executable (.exe).

But Delphi can call dynamic link libraries (.dll) created
in any language.

If you want to know how to call a 'C' function in a DLL,
please add a comment asking so, and I'll add the code.
0
 

Author Comment

by:chj
ID: 1336432
Comment to slp

I should have guessed as much, but when I look through Delphi's help files, there are references to routines startings of with a void statement. This to me implies c. This may be part of the InstallShield help though, and there I belive you can imped c code.

WhatI realy need to do is to have e-mail functionality from my program. I have access to the c code for mail programs and I believe that you can run external exacutable from C but not Delphi.

How would you go about givving sendmail capability to a program you were developing?

Thanks

Chris
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question