Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delphi DLL called from Delphi and then from C

Posted on 2002-04-17
4
Medium Priority
?
197 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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

636 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