Good point, thanks. I did send in a 0, which behaved better.
But the env still didn't get read, but I didn't investigate that
much. I resorted to putting a object frontend, and having the
object handle the env & OpenLog, so actuall values are always
sent as arguments.
On 03-Jun-2003 Nick Ing-Simmons wrote:
> <[EMAIL PROTECTED]> writes:
>>
>> ..The problem is that the c function is not getting the vars from
>> the env, when running under Perl. The getenv() does not seem to
>> work. If I set the variables $ENV{PROJECT} = 9999 and $ENV{SERVICE} = 1,
>> call the function OpenLog(Arg, Arg, "", ""), the function will see the
>> 2 empty strings and attemt to read the values from the env. These env
>> variables could be set by a shell script before the perl is run. The perl
>> code could be last in a series of utilities that use these env vars. It works
>> if the actual arguments are sent to the function, but I would like to have
>> the interface behave as the C calls do. Here is some of the C code if my
>> explaination is to vague,
>>
>>
>> DotsLog.Project = GETENV(inproject, "PROJECTNUM");
>>>>
>>>> #define GETENV(var, env) ( (var) == NULL ? getenv((env)) : (var) )
>
> But you are not passing NULL you are passing ""
>
> NULL is (char *) 0
> "" is pointer to a byte containing '\0'.
>
> You may need a custom typemap to cause "" (or better undef)
> to be passed to your library as NULL.
>
> --
> Nick Ing-Simmons
> http://www.ni-s.u-net.com/
>
----------------------------------
E-Mail: [EMAIL PROTECTED]
Date: 03-Jun-2003
Time: 14:00:12
----------------------------------