| Author |
Message |
majestik666@gmail.com *nix forums beginner
Joined: 03 Mar 2006
Posts: 4
|
Posted: Fri Mar 03, 2006 3:18 am Post subject:
__declspec(dllexport) equivalent under linux / osx with g++ ?
|
|
|
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
|
Posted: Fri Mar 03, 2006 4:19 am Post subject:
Re: __declspec(dllexport) equivalent under linux / osx with g++ ?
|
|
|
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
|
Posted: Fri Mar 03, 2006 2:20 pm Post subject:
Re: __declspec(dllexport) equivalent under linux / osx with g++ ?
|
|
|
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
|
Posted: Sat Mar 04, 2006 2:20 am Post subject:
Re: __declspec(dllexport) equivalent under linux / osx with g++ ?
|
|
|
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
|
Posted: Thu Aug 10, 2006 6:06 am Post subject:
__declspec(dllexport) counterpart under linux
|
|
|
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 |
|
 |
|