Olivier CLERE wrote:
> Enclosed is the C code (which works) and
> the Perl code I implemented (which does not seem
> to work).
What do you mean by "doesn't work"? In what context do you use %ldapctrl and
@tableau? What do you expect to happen, and what does happen?
> Do you have any suggestions?
>
> Thanks in advance,
>
>
> --------------------------
>
> %ldapctrl= (
> ldctl_oid=>"2.16.840.1.113730.3.4.2",
> berval=> {
> bv_len=>"3",
> bv_val=>"123",
> },
In C you call this ldctl_value; I'm not sure why you call it "berval" here.
> ldctl_iscritical=>"0",
> );
>
> @tableau=(%ldapctrl,null,null);
You should use \%ldapctrl here -- you need to take a reference to the hash,
otherwise the hash flattens into a list which get put into the array. (Just
as you need to take the address of the LDAPControl structure in C, rather
than putting the structure itself into the array -- though C does also have
arrays of structures, which Perl doesn't.)
>
> --------------------------
>
> LDAPControl *tableau[3], ldapctrl;
> ldapctrl.ldctl_oid = "2.16.840.1.113730.3.4.2";
> ldapctrl.ldctl_value.bv_len = strlen(123);
> ldapctrl.ldctl_value.bv_val = 123;
Shouldn't this be:
strcpy(ldapctrl.ldctl_oid, "2.16.840.1.113730.3.4.2");
ldapctrl.ldctl_value.bv_len = strlen("123");
strcpy(ldapctrl.ldctl_value.bc_val, "123");
(possibly with two previous malloc()s for ldctl_oid and bc_val)?
> ldapctrl.ldctl_iscritical = 1;
>
> tableau[0] = &ldapctrl;
> tableau[1] = NULL;
> tableau[2] = NULL;
The code where you use ldapctrl and/or tableau would help; also, the
definition of the LDAPControl C structure. I assume you want to interface to
some pre-written code, in which case you have to follow the conventions that
code expects. For example, if the code expects a C structure, you may have
to use pack() in Perl to simulate this.
Cheers,
Philip
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, send email to
[EMAIL PROTECTED]