473,666 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing Compile-time Independent Code

Hi, everyone,

I'm working on a software project that contains some C++ code that I would
like to be common to two separate projects. Ideally, I'd like to have each
of these separate projects conditionally compile and link the common code
per environment configuration. However, I feel that the very nature of this
common code (that it is mutually compile- and link-time dependent with the
software projects) precludes this type of setup. As such, I think that the
solution may fall into the realm of programming instead of build environment
configuration.

In an independent discussion I've been having in a build environment mailing
list, someone mentioned that I should investigate a plugin type architecture
for this solution. I believe the implication here is that stub header files
are provided, perhaps in conjunction with dummy libraries, that serve as
interfaces to real libraries that might be statically or dynamically linked
later, or even executed as a separate process. However, I'm not quite
certain.

Can anyone recommend a book, webpage, or example code that would show me how
I can break physical dependencies in logically dependent C++ code? I've
enjoyed some of the techniques in the John Lakos book
(_Large_Scale_C ++_Programming_ , I belive) but think that I need another
physical-minded C++ design book to help me out.

Thank you for your help!
Scott

--
Remove ".nospam" from the user ID in my e-mail to reply via e-mail.
Jul 19 '05 #1
1 1786
"Scott Brady Drummonds" <sc************ **********@inte l.com> wrote in message news:<bf******* ***@news01.inte l.com>...

there are bits of your post I didn't quite follow.
I'm working on a software project that contains some C++ code that I would
like to be common to two separate projects.
sounds straight forward. Make the common code into a library
(or libraries). Suppose project-A has a big lump of code to manage say,
sockets. And you now need project-B to also manage sockets. Create a socket
library from the project-A code. Compile and link it with the two
projects.
Ideally, I'd like to have each
of these separate projects conditionally compile and link the common code
per environment configuration.
not sure where the conditional compilation came from. I've sometimes
found it hard to manage. I think I need to know more about what you're
trying to do.
[...] However, I feel that the very nature of this
common code (that it is mutually compile- and link-time dependent with the
software projects) precludes this type of setup.
lost me.

[...] As such, I think that the
solution may fall into the realm of programming instead of build environment
configuration.
?

In an independent discussion I've been having in a build environment mailing
list, someone mentioned that I should investigate a plugin type architecture
for this solution. I believe the implication here is that stub header files
are provided, perhaps in conjunction with dummy libraries, that serve as
interfaces to real libraries that might be statically or dynamically linked
later, or even executed as a separate process. However, I'm not quite
certain.


ask the person who sugested this

<snip>
--
Nick Keighley
Jul 19 '05 #2

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

Similar topics

3
2504
by: Torsten Mohr | last post by:
Hi, based on the example module "noddy" i wrote an own one and i have problems accessing the elements in the python objects. I defined the example object: typedef struct { PyObject_HEAD int num; } pmod_obj;
7
4307
by: Markus | last post by:
Hi, Well, I'm still a newbie to C++, so excuse my maybe (probably???) stupid question...btw, I use gcc 2.95.2. Here are my (test) funtions: mainfunc.cpp: #include <iostream> #include "func1.h" //so it looks in the same dir, right? int main(){
27
3252
by: hpy_awad | last post by:
I wrote that program from a book that my compile that program correctly under C++ compiler but I got those errors for compiling under unix !! Errors- -------- part10_iti_r01_ch10_verbo_menu_driven_programs.c: In function `main': part10_iti_r01_ch10_verbo_menu_driven_programs.c:6: warning: declaration of `argc' shadows a parameter part10_iti_r01_ch10_verbo_menu_driven_programs.c:7: warning:
10
2181
by: Jason Curl | last post by:
Dear C group, I'm very interested in writing portable C, but I only have GNU, Sparc and Cygwin to compile on. What I find is the biggest problem to writing portable C is what headers to include. What sites do people know about that are comprehensive in their differences? For example, MacOSX complained about <string.h>. With Solaris I needed
4
1031
by: Abubakar | last post by:
Hi, on some opensource group when I tried to compile there compiler with vc++ someone said this to me: "BTW, does the VS.NET license even allows one to write compilers with it? I remember reading the Visual C++ once and it expressly prohibited writing competing products (including compilers)." Is this true? Ab.
4
7704
by: Mark Kamoski | last post by:
Hi Everyone. What is the real difference between writing a Sub versus writing a Function with no return value? It seems to me that both of these would need to compile to the same IL, so it seems they are identical. Please advise.
7
6038
by: mast2as | last post by:
Hi everyone I know this not necessarily the best newsgroup to ask that sort of question but please be nice ;-) as I am not too sure where to start with this problem. I use c++ for my work but always write applications that didn't need GUI. And know there's a project for which I'd need to have one. I looked around on the net and it's really incredible to see that there's nothing really clearly written about the subject. The OS that I...
6
2499
by: uche | last post by:
can someone tell me if this is a correct way to writing a vector of structure to a file... will this write the contents of a vector into the file? bool Cwrite (vector <struct&write, const string & filename) { ofstream myfile (filename); if (myfile.is_open()) { myfile << write;
7
15447
by: Anil Gupte | last post by:
I have read a lot about getting lines from a multiline textbox in VB.Net. However, I cannot for the life of me figure out how to write to a multiline textbox. Basically, I have created an array of strings which I want to "paste" into a multiline textbox. Any ideas? -- Anil Gupte www.keeninc.net www.icinema.com
16
2512
by: rahul | last post by:
void foo(void) { /* blah blah */ } char buf = {....}; memcpy( (void *)&foo, buf, sizeof buf); This thing is giving segmentation fault on RHEL 5/gcc 4.1. Is the text segment protected? I am assuming foo has enough space for buf.
0
8443
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8866
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.