?
Solved

Delphi DLL called from Delphi and then from C

Posted on 2002-04-17
4
Medium Priority
?
196 Views
Last Modified: 2010-04-04
The DLL has two entry points
Func1 and Func2. Delphi Exe calls
Func1 which opens a file and writes to it, it works.
I want to call Func2 from C and append to the
same file.
I have :

Procedure func2(Param: PChar): PChar; stdcall;
     external ;
 
export
 func1 index 1,
 func2 index 2;
 
 From C do I just do:
   int func2(char*);
            ....
   nRet = func2("Hi Mom!");
   
   Any tips? What statement goes in the C code
to reference the DLL - here by number;
   
   Many Thanks , Mark
0
Comment
Question by:mebarron
[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
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6947305
In C you will have to generate the .lib file to statically link to.
Also your C declaration needs a declspec(dllimport) to force the stdcall calling convention.
0
 

Author Comment

by:mebarron
ID: 6947496
I do not understand your first sentence.How
do I statically generate a .lib file?
0
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 200 total points
ID: 6947774
You will need to generate a .lib file from the DLL.
There is a tool somewhere with your C++ compiler. Maybe the project automatically generates it already (i am not used to modern C++ compilers).
To use the DLL you add the .lib file to the files the linker should link in.
0
 

Author Comment

by:mebarron
ID: 6947830
many thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

765 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