Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you call a dll

Hi,

I built a dll using vc++. I compiled it and it works fine. Now, how to
I test it? How can I call it from a c++ app? Do I use #import?

Thanks
Eric
0 Kudos
Message 1 of 3
(2,881 Views)
You use #import to generate classes that interface to COM DLLs. For a regular C++ DLL, you need to include, in your application source files that are using the DLL, a header file that defines the types and/or functions you are exporting from your DLL. Your application project needs to reference the DLL import library (DllName.lib) that was generated when you built your DLL. Finally, to run the application, you need to place the DLL in a location where the OS will find it to load it. In this case, you probably want to copy your DLL to the same directory as the EXE.

This is really a high-level view of what you need to do. I recommend that you check out the information in MSDN about building and using DLLs. One good starting point is here:
http://msdn.micros
oft.com/library/default.asp?url=/library/en-us/vccore/html/_core_DLL_Topics.asp

David Rohacek
National Instruments
Message 2 of 3
(2,881 Views)
Hi,

Thanks, you helped out a lot. I learned that you can communicate
implicitly or explicitly. Imo, you need the header and lib files while Exp
you can use dumpbin.exe to see what functions are exported and availible to
use.

Thanks,
Eric


"drohacek" wrote in message
news:5065000000050000002AB30000-1031838699000@exchange.ni.com...
> You use #import to generate classes that interface to COM DLLs. For a
> regular C++ DLL, you need to include, in your application source files
> that are using the DLL, a header file that defines the types and/or
> functions you are exporting from your DLL. Your application project
> needs to reference the DLL import library (DllName.lib) that was
> generated when you built your DLL. Finally
, to run the application,
> you need to place the DLL in a location where the OS will find it to
> load it. In this case, you probably want to copy your DLL to the same
> directory as the EXE.
>
> This is really a high-level view of what you need to do. I recommend
> that you check out the information in MSDN about building and using
> DLLs. One good starting point is here:
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html
/_core_DLL_Topics.asp
>
> David Rohacek
> National Instruments
0 Kudos
Message 3 of 3
(2,881 Views)