[OTR-users] OTR Perl Module

Patrick Tierney ptierney at ucla.edu
Thu Jun 18 23:41:42 EDT 2009


Great, that worked!  For future information, my final .xs code looks like this:

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "INLINE.h"

#define context otr_context
#include <libotr/context.h>
#undef context

#include <libotr/proto.h>
#include <libotr/message.h>
#include <libotr/privkey.h>

Patrick



On Thu, Jun 18, 2009 at 7:05 PM, Ian Goldberg<ian at cypherpunks.ca> wrote:
> On Thu, Jun 18, 2009 at 03:18:52PM -0700, Patrick Tierney wrote:
>> Hello,
>>
>> I am writing a Perl module for OTR, and I've run into an unfortunate
>> error:  both Perl 5 and OTR declare structs called "context", and this
>> results in an obvious redefinition error when compiling.  I am writing
>> the module using Inline / XS, and including perl's EXTERN.h, perl.h,
>> XSUB.h, and INLINE.h, along with libotr/proto.h, etc.
>>
>> I would appreciate any suggestions on how to get around this, though I
>> would also purpose changing the struct name to "otr_context" or such
>> in future releases of the OTR library.
>
> Stupid C with global structure name scope.  ;-)
>
> You can always do this trick:
>
> #define context otr_context
> #include <libotr/context.h>
> #undef context
>
> I haven't tested it, but it has a shot at working...
>
>   - Ian
> _______________________________________________
> OTR-users mailing list
> OTR-users at lists.cypherpunks.ca
> http://lists.cypherpunks.ca/mailman/listinfo/otr-users
>



More information about the OTR-users mailing list