?
Solved

Loading a dll

Posted on 1998-06-09
2
Medium Priority
?
171 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
[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 7

Accepted Solution

by:
galkin earned 400 total points
ID: 1316449
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
ID: 1316450
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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
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…
Suggested Courses

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