#### Archived

This topic is now archived and is closed to further replies.

# Precompiled Headers, and Static Libs

This topic is 5221 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

##### Share on other sites
Precompiled headers are something else entirely.

The solution is to divide your header files into two sets: public and private. You code uses both sets, but you distribute only the public header files.

You may have to reorganize your code and perhaps add extra code to decouple the interface from the implementation.

John Bolton
Page 44 Studios
Current project: NHL Faceoff 2005 PS2

##### Share on other sites
if i want to hide completely my source code from anyone who want to use my engine, can''t i use static techniques?? Static libraries etc this is my question, i can''t afford to give a single file, so am i candidate for DLLs??

Or there is another static way?

##### Share on other sites
You *must* at least supply the header files, together with your lib or dll in order to keep it usable. There is no way around it.

As John said, separate implementation from interface. There is no harm releasing the interface headers for even the most secret implementation on earth. In fact, it is even encouraged. Clean and well documented interface specs are crucial for developers using a third party API.

##### Share on other sites
ok, as far as i and you know, it''s the only solution, i have given it up, and now my *.LIB contains all the headers, and they are also very tightly packed with comments.

But no one dared to answer this question:
How Drunken Hyena used his engine without even giving the implementation?? see his tutorials.

##### Share on other sites
quote:
Original post by imDivineLight

in the lesson examples of drunken hyena, he uses some very good technique to fight this problem. I don't know how he has included his engine in lesson project, because the workspace shows header files of engine, but when i open them it says, no such file create a new one?, and still those headers are used in lesson code. Kinda invisible, this thing attracts me most any way around this?

Taken from init_d3d.cpp (part of Drunken Hyena's Direct3D tuts)

//// init_d3d.cpp - Initializing Direct3D9//// Copyright (c) 2003 Drunken Hyena//// This program is free software; you can redistribute it and/or modify it// under the terms of the Drunken Hyena License.  If a copy of the license was// not included with this software, you may get a copy from:// http://www.drunkenhyena.com/docs/DHLicense.txt//#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers#include <D3DX9.h>#include "../common/dhWindow.h"#include "../common/dhD3D.h"#include "../common/dhUtility.h"// ....... rest of code follows here

Notice those last three #includes ?
There you see how he includes his headers (part of his common library) into the project.

Edit: tags messed up

[edited by - Direct4D on June 8, 2004 7:42:59 AM]

##### Share on other sites
quote:
Original post by Direct4D
Notice those last three #includes ?
There you see how he includes his headers (part of his common library) into the project.

Edit: tags messed up

[edited by - Direct4D on June 8, 2004 7:42:59 AM]

i think you have an older version of his tuts. i have the new one which use his own engine, some kind of wrapper, look here, it includes those headers, but i never see them included in the zip, how is that possible?

#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers#include <D3DX8.h>#include <stdio.h>#include <mmsystem.h>#include "dhEngine.h"#include "dhSimpleMesh.h"#include "dhFPSTimer.h"

##### Share on other sites
quote:

it includes those headers, but i never see them included in the zip, how is that possible?

It''s not, unless the headers are actually there and you didn''t notice them. Next time you ask a question about something you might want to try googling it, first:
Googling "what are precompiled headers" gave me this as the first result.

##### Share on other sites
quote:
Original post by imDivineLight
...
i think you have an older version of his tuts. i have the new one which use his own engine, some kind of wrapper, look here, it includes those headers, but i never see them included in the zip, how is that possible?
...

What zip do you mean ? A tutorial or the dhEngine ?

If you don''t have these headers then the tuts won''t even compile.

Like JohnBolton allready said: (though he said it with less words and probably alot more clear)

Just include the headers that contain the class definitions and function prototypes with your libs.
And the headers that contain classes and or function prototypes that are for "internal" use only, can be kept private. Don''t destribute those with the lib.

Suppose you have a function that uses your uber secret algorithm.
Then what harm would it cause to distribute it''s prototype in a header ?
in ubersecret.h:
int PerformUberSecretAlgorithm(int a, int b);

The actual implementation is hidden in the cpp file. Which is compiled and thus not distributed with your lib.
in ubersecret.cpp

int PerformUberSecretAlgorithm(int a, int b){
// secret algorithm goes here

}

##### Share on other sites
Thanks for the info, and yah in the tutorial, they are not given, and i never recompiled it, so i think that was majik, but when i recompiled it it says fatal error no dhEngine.h, so i have to download the dhEngine also

Sorry for misunderstanding, ok so my lesson is that there''s no way to hide those headers because there''s no reason for them alright? but what about inline functions they are in those headers?

1. 1
2. 2
3. 3
4. 4
Rutin
12
5. 5

• 12
• 16
• 10
• 14
• 10
• ### Forum Statistics

• Total Topics
632660
• Total Posts
3007693
• ### Who's Online (See full list)

There are no registered users currently online

×