473,396 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How protect source code in template library?

Hi!
I am a newbie in C++, it seems compiler must see the source code of
template classes(with .h files and .cpp files£©when compile. I want to
prevent others from getting .cpp files. How should i do?

Thanks!
Jul 23 '05 #1
2 3163
On Mon, 28 Feb 2005 13:25:39 +0800, "Lokicer" <lo*****@163.com> wrote
in comp.lang.c++:
Hi!
I am a newbie in C++, it seems compiler must see the source code of
template classes(with .h files and .cpp files£©when compile. I want to
prevent others from getting .cpp files. How should i do?

Thanks!


Then don't distribute your code with template classes. Provide
binaries of pre-compiled classes only with header files. Be prepared
to produce many different versions for different operating systems,
compilers, and even versions of the same compiler.

Or select another language. C++ is not particularly designed for
this.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jul 23 '05 #2
"Lokicer" <lo*****@163.com> wrote in message
news:cv**********@mail.cn99.com...
I am a newbie in C++, it seems compiler must see the source code of
template classes(with .h files and .cpp files£©when compile. I want to
prevent others from getting .cpp files. How should i do?


To instantiate template code for new (user-provided) data types,
the compiler does need to see the template source code (which
is commonly left into .h files). You can't get around that,
but your template code could be a thin layer around non-template
code (stored in .cpp files) that you distribute into a
compiled library.
It is common enough for proprietary C++ libraries to be
distributed as, e.g. on Windows, .h files and a .lib+.dll
compiled library (NB: this is OT here, ask on a platform-
specific newsgroup).

When you do that, you need to be aware potential
incompatibilities among C++ compilers on some platforms
(while the way to call C-style functions is pretty much
standardized everywhere, on some operating systems/processors
classes/overloaded functions/etc can be implemented in
incompatible ways -- different "ABI"s).
This is probably what Jack Klein was thinking about.

Besides that, C++ is actually among the languages that
are the more difficult to reverse-engineer from compiled code.
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: mosfet | last post by:
I have a question I would like to developp an app in .NET but I would like to keep my source code secret. However since anyone can decompile a binary to find the source code...
4
by: Cablito | last post by:
Is there a way to protect my class libraries? I have for instance, a class library full of my base forms and classes latter inherited by various projects. A lot of logic is within those...
4
by: jack | last post by:
Hi there, I have a short question about template function definition. 1) The following files will not compile in M$ VC++ but will have no problem with g++. 2) However, if I uncomment all...
4
by: Steven T. Hatton | last post by:
Are the Standard Headers as described in ISO/IEC 14882:2003 available in source file form as they appear in the standard? What I mean by this is, for example §20.4 describes the Header<memory> and...
15
by: Fady Anwar | last post by:
Hi while browsing the net i noticed that there is sites publishing some software that claim that it can decompile .net applications i didn't bleave it in fact but after trying it i was surprised...
3
by: Ganesh Muthuvelu | last post by:
Hi, I have a ASP .NET application that we give to our clients for them to deploy it in their web server and use it. My concern is that all of my ASPX pages source code is open and our clients can...
2
by: Mikey | last post by:
Sample VB .NET source code to create mailing labels or customized letters using MS Word MailMerge This VB .NET source code will start MS Word and call methods and set properties in MS Word to...
3
by: yservel | last post by:
Hi everybody. I was just wondering how did editors were protecting their source code from decompilers and reverse engeneering. I heard one method of source code protection was by obfuscation: ...
2
by: clintonb | last post by:
I'm using: Microsoft Visual Studio 2005 Version 8.0.50727.42 Issue 1: We have a solution with a web project and some class library projects. The web project references the class library...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.