On Wed, Apr 13, 2005 at 11:16:46AM +0530 Sriram Mokkapati wrote:

> Hi All,
>  i'm using the following XS file.
>  #include "EXTERN.h"
> #include "perl.h"
> #include "XSUB.h"
> 
> #include "ppport.h"
> 
> #include <test.h>
> 
> #include "const-c.inc"
> 
> typedef struct t_PS_PHYSICAL_OBJECTINFO
> {
> CString strName; 
> CString strUserName; 
> BOOL bID; 
> BOOL bIRD; 
> int nVolumes; 
> DWORD dwTotSec; 
> 
> } PS_PHYSICAL_OBJECTINFO;
> 
>  typedef struct t_PS_LOGICAL_OBJECTINFO
> {
> CString strName; 
> CString strUserName;
> BOOL bID; 
> BOOL bIRD;
> DWORD dwStartSec;
> DWORD dwTotSec; 
> int nSPC; 
> 
> } PS_LOGICAL_OBJECTINFO;
> 
> 
> MODULE = ProScript PACKAGE = ProScript 
> 
> TYPEMAP
> PS_PHYSICAL_OBJECTINFO * T_PTROBJ 

You can't put typemaps into the .xs file. You have to put the above two
lines into the file 'typemap', ordinarily located in the same directory
as the .xs file.

> INCLUDE: const-xs.inc
> 
> 
> BOOL 
> PSGetPhysicalObjectInfo (strObjectName,pObjectInfo)
> char * strObjectName
> PS_PHYSICAL_OBJECTINFO * pObjectInfo
> 
> 
> MODULE = ProScript PACKAGE = PhysicalObjectptr PREFIX = rpcb_
>  void
> rpcb_DESTROY(pPhysicalObject)
> PS_PHYSICAL_OBJECTINFO * pPhysicalObject
> CODE:
> free( pPhysicalObject);

Other than that, I don't think you need the PREFIX stuff.

    MODULE = ProScript  PACKAGE = PhysicalObjectptr
    
    void
    DESTROY (obj)
        *PS_PHYSICAL_OBJECTINFO *obj:
    CODE:
        ...

will work just as well.

Finally, the camel-casing really hurts the eyes. I'd try to go for all
lower-case variable names, sprinkling in an occasional '_' where it
helps readability.

Tassilo
-- 
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);

Reply via email to