niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » C++
__declspec(dllexport) equivalent under linux / osx with g++ ?
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
Author Message
majestik666@gmail.com
*nix forums beginner


Joined: 03 Mar 2006
Posts: 4

PostPosted: Fri Mar 03, 2006 3:18 am    Post subject: __declspec(dllexport) equivalent under linux / osx with g++ ? Reply with quote

Hi,

i'm bulding a multi platform app under windows/linux/osx
an i have a bit of trouble exporting c++ symbols from
a dynamic library...
Under windows, i compile a dll exporting symbols
using :
__declspec(dllexport) & __declspec(dllimport)

I do export non-static and static members from my c++ code
without any problems ...
But I can't find a way to do it uner linux or osx with g++
anybody can help on this one ?

Thanks a lot
Francois
Back to top
Jack Klein
*nix forums Guru


Joined: 19 Feb 2005
Posts: 776

PostPosted: Fri Mar 03, 2006 4:19 am    Post subject: Re: __declspec(dllexport) equivalent under linux / osx with g++ ? Reply with quote

On 2 Mar 2006 19:18:10 -0800, "majestik666@gmail.com"
<majestik666@gmail.com> wrote in comp.lang.c++:

Quote:
Hi,

i'm bulding a multi platform app under windows/linux/osx
an i have a bit of trouble exporting c++ symbols from
a dynamic library...
Under windows, i compile a dll exporting symbols
using :
__declspec(dllexport) & __declspec(dllimport)

I do export non-static and static members from my c++ code
without any problems ...
But I can't find a way to do it uner linux or osx with g++
anybody can help on this one ?

Thanks a lot
Francois

Ask in the news:comp.os.linux.development.* family. These things are
not part of the C++ language to start with, they are non-standard
platform specific extensions.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
Back to top
Asfand Yar Qazi
*nix forums beginner


Joined: 24 Mar 2005
Posts: 29

PostPosted: Fri Mar 03, 2006 2:20 pm    Post subject: Re: __declspec(dllexport) equivalent under linux / osx with g++ ? Reply with quote

Jack Klein wrote:
Quote:
On 2 Mar 2006 19:18:10 -0800, "majestik666@gmail.com"
majestik666@gmail.com> wrote in comp.lang.c++:


Hi,

i'm bulding a multi platform app under windows/linux/osx
an i have a bit of trouble exporting c++ symbols from
a dynamic library...
Under windows, i compile a dll exporting symbols
using :
__declspec(dllexport) & __declspec(dllimport)

I do export non-static and static members from my c++ code
without any problems ...
But I can't find a way to do it uner linux or osx with g++
anybody can help on this one ?

Thanks a lot
Francois


Ask in the news:comp.os.linux.development.* family. These things are
not part of the C++ language to start with, they are non-standard
platform specific extensions.


Or perhaps in the gnu.gcc.help newsgroup

--
To reply, take of all ZIGs !!

Alternative email address: emailZIG@asfandyarZIG.cjbZIG.netZIG
Back to top
JH Trauntvein
*nix forums beginner


Joined: 28 Mar 2005
Posts: 12

PostPosted: Sat Mar 04, 2006 2:20 am    Post subject: Re: __declspec(dllexport) equivalent under linux / osx with g++ ? Reply with quote

majestik666@gmail.com wrote:
Quote:
Hi,

i'm bulding a multi platform app under windows/linux/osx
an i have a bit of trouble exporting c++ symbols from
a dynamic library...
Under windows, i compile a dll exporting symbols
using :
__declspec(dllexport) & __declspec(dllimport)

I do export non-static and static members from my c++ code
without any problems ...
But I can't find a way to do it uner linux or osx with g++
anybody can help on this one ?


I might be barking mad here but I believe, based upon my own experience
of porting a windows DLL to a linux shared library, that, with a shared
library, you don't have control over which symbols are exported from
the DLL.

I have, by the way, always preferred to use a .def file to declare the
exports from a DLL. I really dislike having to muck with function
signatures.

Regards,

Jon Trauntvein
Back to top
fxlchic
*nix forums beginner


Joined: 10 Aug 2006
Posts: 1

PostPosted: Thu Aug 10, 2006 6:06 am    Post subject: __declspec(dllexport) counterpart under linux Reply with quote

you can consult dlltool manpage to find the solution:
man dlltool:

In order to mark a function as being exported from a DLL, it needs to have an -export:<name_of_function> entry in
the .drectve section of the object file. This can be done in C by using the asm() operator:

asm (".section .drectve");
asm (".ascii \"-export:my_func\"");

int my_func (void) { ... }


for example:
windows: __declspec(dllexport) void NCScnetSetTimeout(BOOLEAN bTimeout);

linux:
asm (".section .drectve");
asm (".ascii \"-export:NCScnetSetTimeout\"");
extern "C" void NCScnetSetTimeout(BOOLEAN bTimeout);
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
The time now is Sat Nov 22, 2008 8:21 pm | All times are GMT
navigation Forum index » Programming » C++
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Help required for configuring the VPN Server in Linux SHERDIL security 0 Sun Nov 19, 2006 2:22 pm
No new posts 2 USB webcams on Linux 2.6.15.4 produce a hang Suyog hardware 1 Fri Jul 21, 2006 7:27 am
No new posts Is there C/C++ corresponding function in Linux for Java's... xiebopublic@gmail.com apps 4 Fri Jul 21, 2006 3:22 am
No new posts Is there C/C++ corresponding function in Linux for Java's... xiebopublic@gmail.com C++ 1 Fri Jul 21, 2006 2:44 am
No new posts equivalent of MAIL>SET FORWARD/USER=ME YOU on unix VAXman-@SendSpamHere.ORG VMS 4 Thu Jul 20, 2006 7:56 pm

Web Advertising | Gas Suppliers | Mortgage Calculator | Remortgages | Debt Consolidation
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2377s ][ Queries: 16 (0.1550s) ][ GZIP on - Debug on ]