Solved

Loading a dll

Posted on 1998-06-09
2
164 Views
Last Modified: 2013-11-20
I have an external function in a dll , how can I access this function?
0
Comment
Question by:sore
2 Comments
 
LVL 7

Accepted Solution

by:
galkin earned 200 total points
Comment Utility
Load library dinamically with LoadLibrary. It returns DLL instance handle. Declare pointer to the function exported from a DLL. Use GetProcAddress Win32 API function to get exported function pointer. This function takes two arguments, first is instance handle obtained via call to LoadLibrary and the second is function name. you also need to cast returned pointer to function to appropriate type. Then you can call the function via the pointer.
0
 

Expert Comment

by:t004024
Comment Utility
Just a small question, why go into loadlibrary and things like that when U can either, just link the application with the library and call that function, or import it in the IMPORTS section of the def file and again call the function directly??? Why not let the DLL load automatically ??
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

7 Experts available now in Live!

Get 1:1 Help Now