We help IT Professionals succeed at work.

Run .dll file

Peter Chan
Peter Chan asked
on
395 Views
Last Modified: 2014-05-14
Hi,
I've built one .dll file using VS 2008. How to directly run it?
Comment
Watch Question

Rikin ShahMicrosoft Dynamics CRM Consultant
CERTIFIED EXPERT

Commented:
Hi,

It is not executable. DLL's cannot be run directly. You need to refer it to other project and use its methods and properties per your needs.

Create any executable (console/windows) project and refer (add it to references) your created DLL to it.

http://msdn.microsoft.com/en-us/library/ms235636.aspx
Peter ChanProblem resolver

Author

Commented:
Many thanks. Can I have the details to show the relevant Form that is from the .dll file, from another console/windows project?
AndyAinscowFreelance programmer / Consultant
CERTIFIED EXPERT

Commented:
Some more information.
DLL stands for Dynamic Link Library.
That roughly translated is a collection of code that is available to ANY program that understands the interface.  Any application can call a function exposed to run a standard set of code.  The calling app can be coded in a completely different language and has no knowledge of how the task is performed.  Because it is dynamic it means the code is stored in the dll - not in any app you code that uses it.

Think of what it would be like for you to have to write code to display the frame of a form every time you wanted a form ....
Rikin ShahMicrosoft Dynamics CRM Consultant
CERTIFIED EXPERT

Commented:
Hi,

I have already included a link http://msdn.microsoft.com/en-us/library/ms235636.aspx. Go throgh these steps.
CERTIFIED EXPERT
Top Expert 2016

Commented:
if the dll is in c or c++ you might think to provide a header file which declares all the exported functions and classes:

// myheader.h
#ifndef MYHEADER_H
#define MYHEADER_H

// put here the include files needed to compile the header
#include <...>

// the following makes your header an import header for other projects
// and an export header for the dll project itself. 
// define MYDLL_EXPORTS in the c++ - precprocessor macros for both debug and release config

#ifdef MYDLL_EXPORTS
#define MYDLL_API __declspec(dllexport)
#else
#define MYDLL_API __declspec(dllimport)
#endif


// exported c  functions functions
#ifdef __cplusplus
extern "C"
{
#endif

MYDLL_API void some_exported_function(int, char*);

#ifdef __cplusplus
}
#endif

// exported classes (or structs)

#ifdef __cplusplus

class MYDLL_API SomeExportedClass
{
    ....
};

// more classes
...


#endif  //  __cplusplus


#endif // MYHEADER_H

Open in new window

with the above you can access functions and classes from other c/c++ projects if you link against the .lib which is output from your dll project.

Sara
Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
DLLs could not be run directly. Instead you can create a Executable application such as console or Windows application and call required the methods of the DLL in the EXE or In the Windows Forms application in each button click call each method separately.
Peter ChanProblem resolver

Author

Commented:
Hi,
I want to raise the form, that is inside one compiled .dll file, within the macro of Outlook. How?
Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
again, you refer to the class/method of the .dll and run the necessary function. the form as such is not "alone" in that .dll, and if it was somebody else that has developed that .dll, he should have given some instructions on how to "call" that form.

now you refer to a macro in outlook, hence the topics are not correct (C, C# ...)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.