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

x
?
Solved

Communication from DLL to a application

Posted on 1998-06-15
2
Medium Priority
?
205 Views
Last Modified: 2013-11-20
How can I call a function in the application from the DLL ?
Is it possible thro CALLBACK? If so please specify how?
Thank U
0
Comment
Question by:aac
[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 Comments
 
LVL 1

Accepted Solution

by:
IgorGrebnev earned 40 total points
ID: 1317957
Dear aac,

You can transfer the pointer to funciton in executable to DLL through pointer to function. The following code can be used
In EXE:

int ExportedFromEXEFunc()

{ return 0;
}

In DLL you should implement the following:

typedef int (*typePtrExpFunc)();

static typePtrExpFunc stm_pFunc = NULL;
 
declspec(_dllexport) void SetEXE_ExportedFunc( typePtrExpFunc pfExpFunc )

{stm_pFunc = pfExpFunc;
}

After calling the SetEXE_ExportedFunc from EXE and setting of static pointer to funciton in executable you can call the function through pointer anywhere in DLL:

(*stm_pFunc)();

0
 

Author Comment

by:aac
ID: 1317958
Instead of using declspec to export the function can I use it directly in my .def file?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

618 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