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

x
?
Solved

Calling a DLL from a C prog

Posted on 1997-12-11
6
Medium Priority
?
227 Views
Last Modified: 2012-05-04
Hi,
How to make a call to a Dll in a C program and then create an exe.
Regards,
AC
0
Comment
Question by:achimala
[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
6 Comments
 
LVL 7

Expert Comment

by:galkin
ID: 1256631
Could you clarify what exactly you want to do. Do you want to call function in a DLL from exe written in c?
0
 

Author Comment

by:achimala
ID: 1256632
Alex,
Thank you so much for responding. I have the following things: (I)An exe, which calls the functions in anohter DLL: The code is:
#include <stdio.h>  
#include <stdlib.h>
#include <string.h>
#include <rctpub.h>
#include <memory.h>
#include <malloc.h>
#include <windows.h>
#include <profpub.h>
#include <gtipub.h>
#include <actmpub.h>
#include <rctmsg.h>
#include <elogpub.h>
#include <rctxpub.h>
#include <fetixpub.h>

int main ( int argc, char * argv[] )
{
   long lCoreSession   = 0;
   long lSessionFolder = 0;  
   int  iRV            = 0;

iRV = RctXInitializeCORESession(&lCoreSession,
&lSessionFolder,"ApplName","FendId"," " );
return(0);
}/*Works fine: doing what it is supposed to do*/

(II)A dll: the code for which is:
#include <windows.h>
int _export FAR CDECL RctXInitializeCORESession(lCoreSession, lSessionFolder,ApplName, FendId, FendPwd);

(III)What I am trying to do is: Create another exe (of course written in C), wherein I would like to call the DLL that I have created in step II!
(IV)The reason for doing all this is to use these exe's in my Oracle*Forms applications.
Regards,
AC
 
0
 
LVL 2

Expert Comment

by:AlFa
ID: 1256633
What 's your compiler version ?
0
Industry Leaders: 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!

 

Author Comment

by:achimala
ID: 1256634
I am using Microsoft Visual C++ version 1.52 (16-bit).
0
 
LVL 4

Accepted Solution

by:
emmons earned 200 total points
ID: 1256635
If you have written the DLL, then you should also have the LIB file associated with it, right? (if not, then run implib, like:
implib yourlib.lib yourlib.dll)
Then, all that you have to do is to include the LIB file on the link line. Something like:
link yourexe, yourexe.exe, null, libw slibcew yourlib, yourexe.def;

There is a way to do the linking dynamically, by loading the library, and then getting the address of the function that you want to call, but the implicit loading described above would seem like the way to go for you.
0
 

Author Comment

by:achimala
ID: 1256636
OK. I am trying to think back to 1.52.
You will need to change the project parameters.
Or, look in the help search for LINK, and let it tell you how to change the linking paramters.
In the dialog for linking, you will find an edit field for "Additional Libraries" that is where you add the yourlib.lib library entry.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

604 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