Solved

Invoking an application thro DLL

Posted on 1998-07-02
6
184 Views
Last Modified: 2013-11-19
How can I invoke an application from the DLL based on some event etc. like my DLL should automatically call some function in my application.
Thank U
0
Comment
Question by:akhila
6 Comments
 
LVL 1

Accepted Solution

by:
sudhirbrat earned 10 total points
ID: 1318625

Akhila
You can write an export function in application just like as you write in DLL, and declare the function in the DLL and call the function from DLL.

It worked for me. Try it.
0
 

Author Comment

by:akhila
ID: 1318626
Should I specify that export function as import in my DLL?
One more doubt...Can I do this same thing across applications ie if my DLL is being used by
two applications, the process spaces will be different. Wont it be a problem to call the functions in that case?
Kindly explaing. I'll try the above.
0
 
LVL 2

Expert Comment

by:rayb
ID: 1318627
You're trying to get the DLL to call into the application that loaded the DLL in the first place?  If so, you'll need to implement some form of callback communications, i.e. your application will have to register a function with the DLL.  This way, when the certain event occurs within the DLL, the DLL can call that registered function.

And, yes, you can use this across different applications, when a DLL is loaded by multiple applications, the memory where the code exists may be shared, but never the data.

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:akhila
ID: 1318628
Rayb,
   Thank U for the answer. I have already used the callback function registering etc..But the problem arises when I use it across the applications. I have 2 applns. and each appln has a different function which has to be called. The applications register their callback functions with DLL. Registering is I just call a function in DLL to which I pass the appln function pointer. I store these function pointers in a global array which is declared  as a shared segment. So, when the function of another appln is invoked in the DLL( which in turn is invoked by another appln) I get an error that the function is out of address space.
Kindly help me.

0
 
LVL 2

Expert Comment

by:SamratAshok
ID: 1318629
Why dont you define a class in DLL with virtual function, derive it in your app and then
use it as a lot simpler callback mechanism.

0
 

Author Comment

by:akhila
ID: 1318630
SamratAshok.
   Even though I derive an virutal function, That function is valid only in the context of my application ie it will be invalid if multiple applications are accessing my DLL and the function in one application is invoked through another application (because the process spaces differ). I want a solution such that my dLL gets invoked on some event automatically and calls the correspoding function in the corresponding application (assuming that all the required function pointers of an application are given to the DLL).
Thank You
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to determine file rename from EventLog ? 2 43
viewing source code from eclipse 13 89
either24  challenge 19 90
pre4 challenge 19 94
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now