Solved

C Code in Delphi ?

Posted on 1997-05-18
3
220 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now