Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

C Code in Delphi ?

Posted on 1997-05-18
3
Medium Priority
?
247 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 200 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

876 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