import vs include

W

worlman385

So the difference between import and include is that:

import = used for binary library like DLL or .Lib files. it's very
similar to include that it load all the header (function definition)
from the DLL file so that we can use the header file just like include

include = just include header (source file)

==========================

#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
rename("EOF", "EndOfFile")
 
J

Joseph M. Newcomer

#import is a Microsoft extension. And you are obviously confused about what these do.

#include simply includes text in the source stream.

#import ONLY works if you have a type library, that is, an ActiveX or COM control. When
you apply it to a .exe or .dll file, it searches for a type library resource.

Since ordinary interfaces do not use typelib structures, this serves no purpose. It
certainly will not apply to .lib files, at least as illustrated. Of the types listed,
they are

A .tlb or .odl file
A progid of a control in a type library
The library ID of the type library
An executable .exe file
A library .dll file contaninig a type library resource (such as an .ocx)
A compound documnt holding a type library
Any other file forat that can be understood by the LoadTypeLib API

This includes:
If the file is a stand-alongtype library implemented by typelib.doo, the dll is loaded
direfctly
If it is a DLL or EXE it is loaded

I really didn't find a coherent reference as how this migtht be done


As such, they appear to ahave little relevants for modest projects, so 80K.220K can
usually be handled by simple algorithms. #include works well if you deal th the powerpf
good design
Make sure you havenot confused the roles of #import directives/
..
So the difference between import and include is that:

import = used for binary library like DLL or .Lib files. it's very
similar to include that it load all the header (function definition)
from the DLL file so that we can use the header file just like include

include = just include header (source file)

==========================

#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
rename("EOF", "EndOfFile")
Joseph M. Newcomer [MVP]
email: (e-mail address removed)
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
 
A

Alexander Dong Back Kim

So the difference between import and include is that:

import = used for binary library like DLL or .Lib files. it's very
similar to include that it load all the header (function definition)
from the DLL file so that we can use the header file just like include

include = just include header (source file)

==========================

#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
rename("EOF", "EndOfFile")

#import is used for .NET Framework.

Look up the MSDN or goodle. Don't ask to these C++ maniacs they are
gonna get pissed off =P

Cheers,
Alexander D. B. Kim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top