how to control C++ symbol visibility using SWIG .i file (C#)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

how to control C++ symbol visibility using SWIG .i file (C#)

RAVI NANJUNDAPPA
Hi,

We've some classes and public methods which needs to have "__attribute ((visibility("default"))) " and some private/internal classes and apis to ""__attribute ((visibility("hidden"))) ".
When we run swig command, we are getting build issues like :
"Syntax error in input(3)"

This is basically due to (as per my understanding) that SWIG is not able understand the __attribute__.
Is there any way to tell SWIG through .i files (OR swig command line options) to make it know about this g++ attribute ?


Thanks and Best Regards,
N Ravi

------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to control C++ symbol visibility using SWIG .i file (C#)

Jake
Before the %include in your .i file, maybe you can simply:

#define __attribute__(x)

-Jake

On Thu, Sep 8, 2016 at 9:23 AM, RAVI NANJUNDAPPA <[hidden email]> wrote:
Hi,

We've some classes and public methods which needs to have "__attribute ((visibility("default"))) " and some private/internal classes and apis to ""__attribute ((visibility("hidden"))) ".
When we run swig command, we are getting build issues like :
"Syntax error in input(3)"

This is basically due to (as per my understanding) that SWIG is not able understand the __attribute__.
Is there any way to tell SWIG through .i files (OR swig command line options) to make it know about this g++ attribute ?


Thanks and Best Regards,
N Ravi

------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user



------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to control C++ symbol visibility using SWIG .i file (C#)

RAVI NANJUNDAPPA
In reply to this post by RAVI NANJUNDAPPA
Jake,


#define __attribute__(x)
This will nullify the effect of __attribute__... I want to retain the effect of __attribute__ as it is a feature of G++ (>=4.0 version) so that I can hide some symbols and export some symbols.
But SWIG is not able to identify __attribute__. Is there any to make SWIG to understand this ?

Thanks and Best Regards,
N Ravi
 
 
--------- Original Message ---------
Sender : Jake <[hidden email]>
Date   : 2016-09-08 20:55 (GMT+5:30)
Title  : Re: [Swig-user] how to control C++ symbol visibility using SWIG .i file (C#)
 
Before the %include in your .i file, maybe you can simply:

#define __attribute__(x)

-Jake

On Thu, Sep 8, 2016 at 9:23 AM, RAVI NANJUNDAPPA <[hidden email]> wrote:
Hi,


We've some classes and public methods which needs to have "__attribute ((visibility("default"))) " and some private/internal classes and apis to ""__attribute ((visibility("hidden"))) ".

When we run swig command, we are getting build issues like :

"Syntax error in input(3)"


This is basically due to (as per my understanding) that SWIG is not able understand the __attribute__.

Is there any way to tell SWIG through .i files (OR swig command line options) to make it know about this g++ attribute ?



Thanks and Best Regards,

N Ravi

------------------------------------------------------------------------------

_______________________________________________

Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user


 
------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to control C++ symbol visibility using SWIG .i file (C#)

Andrew Haining
You only want to disable it in the swig pass, swig doesn't need to be aware of attributes.
To do that, use the SWIG preprocessor.
#ifdef SWIG
#define __attribute__(x)
#endif

Although you probably shouldn't be using the attribute flags directly if you want to maintain portability.
Andy.
________________________________________
From: RAVI NANJUNDAPPA <[hidden email]>
Sent: 11 September 2016 05:41
To: Jake; RAVI NANJUNDAPPA
Cc: [hidden email]
Subject: Re: [Swig-user] how to control C++ symbol visibility using SWIG .i file (C#)

Jake,


#define __attribute__(x)
This will nullify the effect of __attribute__... I want to retain the effect of __attribute__ as it is a feature of G++ (>=4.0 version) so that I can hide some symbols and export some symbols.
But SWIG is not able to identify __attribute__. Is there any to make SWIG to understand this ?

Thanks and Best Regards,
N Ravi


--------- Original Message ---------
Sender : Jake <[hidden email]>
Date   : 2016-09-08 20:55 (GMT+5:30)
Title  : Re: [Swig-user] how to control C++ symbol visibility using SWIG .i file (C#)

Before the %include in your .i file, maybe you can simply:

#define __attribute__(x)

-Jake

On Thu, Sep 8, 2016 at 9:23 AM, RAVI NANJUNDAPPA <[hidden email]> wrote:
Hi,


We've some classes and public methods which needs to have "__attribute ((visibility("default"))) " and some private/internal classes and apis to ""__attribute ((visibility("hidden"))) ".

When we run swig command, we are getting build issues like :

"Syntax error in input(3)"


This is basically due to (as per my understanding) that SWIG is not able understand the __attribute__.

Is there any way to tell SWIG through .i files (OR swig command line options) to make it know about this g++ attribute ?



Thanks and Best Regards,

N Ravi

------------------------------------------------------------------------------

_______________________________________________

Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user




______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________


Digital Barriers e-Mail Confidentiality and Disclaimer This message contains confidential information and is intended only for the individual named. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. Digital Barriers plc is a company registered in England and Wales. Registered number: 7149547. Registered office: Cargo Works, 1-2 Hatfields, London SE1 9PG, United Kingdom. For further information about Digital Barriers, please visit www.digitalbarriers.com.

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Loading...