Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-16-2007, 11:32 PM   #1
Registered: Mar 2003
Location: Malaysia
Posts: 63

Rep: Reputation: 15
How to build a C++ portable network application on Win32 and POSIX systems?

Dear All,
I have written a network application on Win32 system (Windows XP) using C++. I, however, realised that I need to have the same application to be portabl on POSIX systems as well. I don't want to use porting technology.

Regarding this issue, I have many question that I need you guys to clarify to me. I will raise up a question here and later will pump the others.

My application has many DDLs that could be linked dynamically to the main process. My question is how could my DLLs be replaced in POSIX system. I mean what is the way that could be used to modulrise applications on POSIX systems?

Your help is much appreciated

Old 05-17-2007, 03:43 PM   #2
Senior Member
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
The applications don't need to be the same; just the communication across the network and (if applicable) the format of a transferable file.

I generally design as much as possible in portable code and leave link points for non-portable interfaces such as threads, GUIs, etc. I try to have all non-portable code isolated in its own libraries so that they can be switched out if necessary at link or run time.

The POSIX equivalent to DLL is shared library, ending with .so or .so.0.1, etc. They are essentially a linked object with no execution entry point and relocatable code. You don't need anything special to create them except for the '-fPIC' gcc option (for relocatable code which can be inserted anywhere into a program at run time), the '-shared' ld option, and optionally the '-soname [name + .so + version]' ld option. A soname is used to denote a compatibility version. For example, if all 0.1 versions of your library use the same API you might have as the soname for,, etc. That way if a program hard-links to it will use, etc. as they are upgraded but won't use

To hard link to a shared library just use '-lyourlib' for at link time. To link at run time (such as a plug-in) check out dlopen.

Last edited by ta0kira; 05-17-2007 at 03:46 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Serial port programming problem (Win32 VS POSIX) chanwing Programming 1 06-29-2005 11:17 AM
How to compile win32 application? dmigh Programming 3 11-20-2004 10:00 AM
Portable WIn32 hdd rottmanj Linux - Hardware 5 07-21-2003 08:05 AM
Porting win32 application into Linux sergeyy Linux - Software 1 06-23-2003 08:57 AM
win32 application Jargon Linux - Newbie 2 05-29-2002 12:26 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:00 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration