Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

C Code in Delphi ?

Posted on 1997-05-18
3
Medium Priority
?
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
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

715 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