Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


questions about include


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 noatom   Members   -  Reputation: 785

Like
0Likes
Like

Posted 03 January 2013 - 10:35 AM

Everyone knows that using include on a file makes the compiler treat that file as it was part of our code.

But what happens when we use include <windows.h> ? This is where i'm a little foggy,suppose we make an exe that uses some code from windows.h,will the code needed be nested inside that little exe?

And here is the question that got me in fog: What happens when we use include in a dll?
Suppose that i make a dll that uses code from the directx headers.Will it nest the required code inside the dll?

I'm asking because in a book,the author says something like this:
if you create the direct3d device in a dll,you don't need to include the directx headers in a project that uses that dll,you can just call functions inside the dll that will use the device(that is in the dll ofcourse) to do stuff.

So how does including in a dll work?

Sponsor:

#2 NewDisplayName   Members   -  Reputation: 359

Like
0Likes
Like

Posted 03 January 2013 - 11:47 AM

if you create the direct3d device in a dll,you don't need to include the directx headers in a project that uses that dll,you can just call functions inside the dll that will use the device(that is in the dll ofcourse) to do stuff

I see that you have answered the query yourself. The reason why you won't need to include same headers into the project, that's using the dll which provides the functions needed, is because that header and related info is already included in the dll.

This is sort of a rule and doesn't change for any .h, .pch. cpp, .cc, .etc. leave alone windows headers.



#3 noatom   Members   -  Reputation: 785

Like
0Likes
Like

Posted 03 January 2013 - 11:57 AM

but wait...does that mean that for exemple if I include a directx sdk header in a dll,that header will just get in the dll file? So if I move the dll to another PC,it won't need the directx sdk,because the header file is already in the dll itself?

#4 NewDisplayName   Members   -  Reputation: 359

Like
0Likes
Like

Posted 03 January 2013 - 09:10 PM

but wait...does that mean that for exemple if I include a directx sdk header in a dll,that header will just get in the dll file? So if I move the dll to another PC,it won't need the directx sdk,because the header file is already in the dll itself?

Unless you're trying to use the same functions from the sdk, which also have been included in the dll, you won't need the header.

Lets consider an example :

 

A project called MyGraphicsImpl is created, that provides the direct3d implementation as part of their MGI.dll. Now you want to use this project and do some of your own things.

They have a method called CustomCreateDevice, which basically does a Direct3D CreateDevice internally. Ofcourse, to use CustomCreateDevice you need to include their header called CustomCreateDevice.h in your code. But there is no need to use anything from DirectX SDK anymore.

This is the underlying concept of quite a few third party source code that is developed and used across the fraternity.

I hope this explains the idea.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS