Returning values via pointers

View: New views
14 Messages — Rating Filter:   Alert me  

Returning values via pointers

by Stefano Mora - EOS S.r.l. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,
i need to call a function in a script file from compiled C code via
G__calc(...) function.
The prototype of the function is:

void formule(unsigned char finest,
    unsigned char voces,
    unsigned short formula,
    unsigned short data,
    float*res,
    unsigned char*change)

How can i build the call (from C to script) and how to handle the pointers
on both side?

Thanks !!
--
Ing. Stefano Mora



Re: Returning values via pointers

by Axel Naumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

you can use

float res = 42.;
sprintf(buf, "formule(..., (float*)0x%x...)", &res);

to "transmit" the pointer address from the calling code into CINT.

Cheers, Axel.


Stefano Mora - Eos S.r.l. wrote:

> Hi all,
> i need to call a function in a script file from compiled C code via
> G__calc(...) function.
> The prototype of the function is:
>
> void formule(unsigned char finest,
>     unsigned char voces,
>     unsigned short formula,
>     unsigned short data,
>     float*res,
>     unsigned char*change)
>
> How can i build the call (from C to script) and how to handle the pointers
> on both side?
>
> Thanks !!
> --
> Ing. Stefano Mora
>
>
>


Re: Returning values via pointers

by Stefano Mora - EOS S.r.l. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, thanks again !
Yes, it works.
Now the script is:

void formule(unsigned char finest, unsigned char voces, unsigned short
formula, unsigned short dato, float*risultato, unsigned char*change)
{
 float fapp;
 unsigned short wapp = dato;
 switch(formula)
 {
  #include "fb4.h"
 };
}

My debug log is:

Init DLL ..
[1776] Loading ok
[1776] VB_FnStr1
[1776] VB_FnStr2
[1776] Note: File "script.c" already loaded
[1776] formule( 0, 0, 10, 600, (float*)0x12f5cc, (unsigned char*)0x12f5dc);
[1776] Error: Unexpected EOF G__fgetstream():2
[1776]  script.c(103)
[1776] Error: Function
{case1:fapp=3.0+dato*0.1;break;case2:fapp=50.0+dato*0.78;break;case3:if(dato
>0)fapp=STR_ONOFF_ON;elsefapp=STR_ONOFF_OFF;break;case4:fapp=dato;break;case
6:if(dato&0x01)fapp=STR_ONOFF_OFF;elsefapp=STR_ONOFF_ON;break;case7:if(dato&
0x1)fapp=STR_ONOFF_OFF;elsefapp=STR_ONOFF_ON;break;case9:fapp=dato*0.068;bre
ak;case10:fapp=dato*0.25;break;case11:fapp=dato*0.39;break;case12:fapp=dato*
0.8;break;case13:fapp=dato*20;break;case14:fapp=dato*23;break;case15:fapp=da
to*5;break;case16:if(dato&0x01)fapp=STR_ONOFF_ON;elsefapp=STR_ONOFF_OFF;brea
k;};} is not defined in current scope
00000029 231.57850816 [1776]  script.c(103)

What does it mean? (The text in the brackets are the content of fb2.h)

I'm not able to find the G__reload() !! In the include file are present only
G__loadfile() and G__unloadfile().
How can i reload/parse the script? Only G__loadfile() or better
G__unloadfile() + G__loadfile ?
--
Ing. Stefano Mora


----- Original Message -----
From: "Axel Naumann" <Axel.Naumann@...>
To: "Stefano Mora - Eos S.r.l." <smora@...>
Cc: <cint@...>
Sent: Thursday, August 30, 2007 10:52 AM
Subject: Re: [CINT] Returning values via pointers


> Hi,
>
> you can use
>
> float res = 42.;
> sprintf(buf, "formule(..., (float*)0x%x...)", &res);
>
> to "transmit" the pointer address from the calling code into CINT.
>
> Cheers, Axel.
>
>
> Stefano Mora - Eos S.r.l. wrote:
> > Hi all,
> > i need to call a function in a script file from compiled C code via
> > G__calc(...) function.
> > The prototype of the function is:
> >
> > void formule(unsigned char finest,
> >     unsigned char voces,
> >     unsigned short formula,
> >     unsigned short data,
> >     float*res,
> >     unsigned char*change)
> >
> > How can i build the call (from C to script) and how to handle the
pointers
> > on both side?
> >
> > Thanks !!
> > --
> > Ing. Stefano Mora
> >
> >
> >


Re: Returning values via pointers

by Axel Naumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Stefano,

Stefano Mora - Eos S.r.l. wrote:

> Hi, thanks again !
> Yes, it works.
> Now the script is:
>
> void formule(unsigned char finest, unsigned char voces, unsigned short
> formula, unsigned short dato, float*risultato, unsigned char*change)
> {
>  float fapp;
>  unsigned short wapp = dato;
>  switch(formula)
>  {
>   #include "fb4.h"
>  };
> }
>
> My debug log is:
>
> Init DLL ..
> [1776] Loading ok
> [1776] VB_FnStr1
> [1776] VB_FnStr2
> [1776] Note: File "script.c" already loaded
> [1776] formule( 0, 0, 10, 600, (float*)0x12f5cc, (unsigned char*)0x12f5dc);
> [1776] Error: Unexpected EOF G__fgetstream():2
> [1776]  script.c(103)
> [1776] Error: Function
> {case1:fapp=3.0+dato*0.1;break;case2:fapp=50.0+dato*0.78;break;case3:if(dato
>> 0)fapp=STR_ONOFF_ON;elsefapp=STR_ONOFF_OFF;break;case4:fapp=dato;break;case
> 6:if(dato&0x01)fapp=STR_ONOFF_OFF;elsefapp=STR_ONOFF_ON;break;case7:if(dato&
> 0x1)fapp=STR_ONOFF_OFF;elsefapp=STR_ONOFF_ON;break;case9:fapp=dato*0.068;bre
> ak;case10:fapp=dato*0.25;break;case11:fapp=dato*0.39;break;case12:fapp=dato*
> 0.8;break;case13:fapp=dato*20;break;case14:fapp=dato*23;break;case15:fapp=da
> to*5;break;case16:if(dato&0x01)fapp=STR_ONOFF_ON;elsefapp=STR_ONOFF_OFF;brea
> k;};} is not defined in current scope
> 00000029 231.57850816 [1776]  script.c(103)
>
> What does it mean? (The text in the brackets are the content of fb2.h)

The switch statement should not contain a nested block outside the case
labels. I.e. you have
switch (formula)
{
  { // <--- no nested block
     { case 1: ...
     }; // <--- no semicolon!
  }; // <--- no nested block, no semicolon
};

Instead use:
switch (formula)
{
  case 1: ...
};

That means fb2.h should only contain

case 1:...
case 2:...

without surrounding '{' '}'.


> I'm not able to find the G__reload() !! In the include file are present only
> G__loadfile() and G__unloadfile().
> How can i reload/parse the script? Only G__loadfile() or better
> G__unloadfile() + G__loadfile ?

Calling G__unloadfile(), G__loadfile() should do it.

Cheers, Axel.

> --
> Ing. Stefano Mora
>
>
> ----- Original Message -----
> From: "Axel Naumann" <Axel.Naumann@...>
> To: "Stefano Mora - Eos S.r.l." <smora@...>
> Cc: <cint@...>
> Sent: Thursday, August 30, 2007 10:52 AM
> Subject: Re: [CINT] Returning values via pointers
>
>
>> Hi,
>>
>> you can use
>>
>> float res = 42.;
>> sprintf(buf, "formule(..., (float*)0x%x...)", &res);
>>
>> to "transmit" the pointer address from the calling code into CINT.
>>
>> Cheers, Axel.
>>
>>
>> Stefano Mora - Eos S.r.l. wrote:
>>> Hi all,
>>> i need to call a function in a script file from compiled C code via
>>> G__calc(...) function.
>>> The prototype of the function is:
>>>
>>> void formule(unsigned char finest,
>>>     unsigned char voces,
>>>     unsigned short formula,
>>>     unsigned short data,
>>>     float*res,
>>>     unsigned char*change)
>>>
>>> How can i build the call (from C to script) and how to handle the
> pointers
>>> on both side?
>>>
>>> Thanks !!
>>> --
>>> Ing. Stefano Mora
>>>
>>>
>>>
>
>


Re: Returning values via pointers

by Stefano Mora - EOS S.r.l. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
i'm very sorry but i'm loosing myself ....
fb2.h doesn't contain any '{', '}' !!
But i simplify the switch() and now i have the following:

void formule(unsigned char finest, unsigned char voces, unsigned short
formula, unsigned short dato, float*risultato, unsigned char*change)
{
 float fapp;
 unsigned short wapp = dato;
 switch(formula)
 {
 case 1:
  wapp=0;
  break;
 };

 *risultato = 1.0f;
}

Running the function i receive the following log that raises some kind of
errors (EOF, scope, float):

0.00000000 [1084] Init DLL ..
0.00085234 [1084] Loading ok
0.00174072 [1084] VB_FnStr1
0.02689057 [1084] VB_FnStr2
0.02702690 [1084] Note: File "script.c" already loaded
0.02725626 [1084] formule( 0, 0, 10, 600, (float*)0x12f5cc, (unsigned
char*)0x12f5dc);
0.02734035 [1084] Error: Unexpected EOF G__fgetstream():2
0.02744036 [1084]  script.c(31)
0.02751327 [1084] Error: Symbol {case1:wapp=0;break;}; is not defined in
current scope
0.02971830 [1084]  script.c(31)
0.02987167 [1084] Warning: Illegal numerical expression 1.0f;}
0.02994738 [1084]  script.c(31)
0.03001806 [1084] Warning: Illegal numerical expression 1.0f;}
0.03010606 [1084]  script.c(31)
0.03017786 [1084] Warning: Automatic variable
{case1:wapp=0;break;};*risultato is allocated
0.03026306 [1084]  script.c(31)
0.03033374 [1084] Error: improper lvalue
0.03044800 [1084]  script.c(31)
0.03053181 [1084] !!!Dictionary position rewound...
0.03156239 [1084] !!!Error recovered!!!
18.88892583 [1084] Closing DLL ..


If I change to '*risultato = 1.0*dato;' i receive the error:
[2248] Error: Symbol dato;} is not defined in current scope


Thanks, regards
--
Ing. Stefano Mora


----- Original Message -----
From: "Axel Naumann" <Axel.Naumann@...>
To: "Stefano Mora - Eos S.r.l." <smora@...>
Cc: <cint@...>
Sent: Thursday, August 30, 2007 12:06 PM
Subject: Re: [CINT] Returning values via pointers


> Hi Stefano,
>
> Stefano Mora - Eos S.r.l. wrote:
> > Hi, thanks again !
> > Yes, it works.
> > Now the script is:
> >
> > void formule(unsigned char finest, unsigned char voces, unsigned short
> > formula, unsigned short dato, float*risultato, unsigned char*change)
> > {
> >  float fapp;
> >  unsigned short wapp = dato;
> >  switch(formula)
> >  {
> >   #include "fb4.h"
> >  };
> > }
> >
> > My debug log is:
> >
> > Init DLL ..
> > [1776] Loading ok
> > [1776] VB_FnStr1
> > [1776] VB_FnStr2
> > [1776] Note: File "script.c" already loaded
> > [1776] formule( 0, 0, 10, 600, (float*)0x12f5cc, (unsigned
char*)0x12f5dc);
> > [1776] Error: Unexpected EOF G__fgetstream():2
> > [1776]  script.c(103)
> > [1776] Error: Function
> >
{case1:fapp=3.0+dato*0.1;break;case2:fapp=50.0+dato*0.78;break;case3:if(dato
> >>
0)fapp=STR_ONOFF_ON;elsefapp=STR_ONOFF_OFF;break;case4:fapp=dato;break;case
> >
6:if(dato&0x01)fapp=STR_ONOFF_OFF;elsefapp=STR_ONOFF_ON;break;case7:if(dato&
> >
0x1)fapp=STR_ONOFF_OFF;elsefapp=STR_ONOFF_ON;break;case9:fapp=dato*0.068;bre
> >
ak;case10:fapp=dato*0.25;break;case11:fapp=dato*0.39;break;case12:fapp=dato*
> >
0.8;break;case13:fapp=dato*20;break;case14:fapp=dato*23;break;case15:fapp=da
> >
to*5;break;case16:if(dato&0x01)fapp=STR_ONOFF_ON;elsefapp=STR_ONOFF_OFF;brea

> > k;};} is not defined in current scope
> > 00000029 231.57850816 [1776]  script.c(103)
> >
> > What does it mean? (The text in the brackets are the content of fb2.h)
>
> The switch statement should not contain a nested block outside the case
> labels. I.e. you have
> switch (formula)
> {
>   { // <--- no nested block
>      { case 1: ...
>      }; // <--- no semicolon!
>   }; // <--- no nested block, no semicolon
> };
>
> Instead use:
> switch (formula)
> {
>   case 1: ...
> };
>
> That means fb2.h should only contain
>
> case 1:...
> case 2:...
>
> without surrounding '{' '}'.
>
>
> > I'm not able to find the G__reload() !! In the include file are present
only

> > G__loadfile() and G__unloadfile().
> > How can i reload/parse the script? Only G__loadfile() or better
> > G__unloadfile() + G__loadfile ?
>
> Calling G__unloadfile(), G__loadfile() should do it.
>
> Cheers, Axel.
>
> > --
> > Ing. Stefano Mora
> >
> >
> > ----- Original Message -----
> > From: "Axel Naumann" <Axel.Naumann@...>
> > To: "Stefano Mora - Eos S.r.l." <smora@...>
> > Cc: <cint@...>
> > Sent: Thursday, August 30, 2007 10:52 AM
> > Subject: Re: [CINT] Returning values via pointers
> >
> >
> >> Hi,
> >>
> >> you can use
> >>
> >> float res = 42.;
> >> sprintf(buf, "formule(..., (float*)0x%x...)", &res);
> >>
> >> to "transmit" the pointer address from the calling code into CINT.
> >>
> >> Cheers, Axel.
> >>
> >>
> >> Stefano Mora - Eos S.r.l. wrote:
> >>> Hi all,
> >>> i need to call a function in a script file from compiled C code via
> >>> G__calc(...) function.
> >>> The prototype of the function is:
> >>>
> >>> void formule(unsigned char finest,
> >>>     unsigned char voces,
> >>>     unsigned short formula,
> >>>     unsigned short data,
> >>>     float*res,
> >>>     unsigned char*change)
> >>>
> >>> How can i build the call (from C to script) and how to handle the
> > pointers
> >>> on both side?
> >>>
> >>> Thanks !!
> >>> --
> >>> Ing. Stefano Mora
> >>>
> >>>
> >>>
> >
> >


Re: Returning values via pointers

by Axel Naumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Stefano,

Stefano Mora - Eos S.r.l. wrote:
> i'm very sorry but i'm loosing myself ....

Yes, this was a nasty one. CINT has a problem parsing
"unsigned char*change"
Adding a space e.g. after the "*" works around this issue. So this
function definition:

void formule(unsigned char finest, unsigned char voces, unsigned short
formula, unsigned short dato, float* risultato, unsigned char* change)

works for me. I will fix it in CINT. Thanks for reporting!

Cheers, Axel.

> fb2.h doesn't contain any '{', '}' !!
> But i simplify the switch() and now i have the following:
>
> void formule(unsigned char finest, unsigned char voces, unsigned short
> formula, unsigned short dato, float*risultato, unsigned char*change)
> {
>  float fapp;
>  unsigned short wapp = dato;
>  switch(formula)
>  {
>  case 1:
>   wapp=0;
>   break;
>  };
>
>  *risultato = 1.0f;
> }
>
> Running the function i receive the following log that raises some kind of
> errors (EOF, scope, float):
>
> 0.00000000 [1084] Init DLL ..
> 0.00085234 [1084] Loading ok
> 0.00174072 [1084] VB_FnStr1
> 0.02689057 [1084] VB_FnStr2
> 0.02702690 [1084] Note: File "script.c" already loaded
> 0.02725626 [1084] formule( 0, 0, 10, 600, (float*)0x12f5cc, (unsigned
> char*)0x12f5dc);
> 0.02734035 [1084] Error: Unexpected EOF G__fgetstream():2
> 0.02744036 [1084]  script.c(31)
> 0.02751327 [1084] Error: Symbol {case1:wapp=0;break;}; is not defined in
> current scope
> 0.02971830 [1084]  script.c(31)
> 0.02987167 [1084] Warning: Illegal numerical expression 1.0f;}
> 0.02994738 [1084]  script.c(31)
> 0.03001806 [1084] Warning: Illegal numerical expression 1.0f;}
> 0.03010606 [1084]  script.c(31)
> 0.03017786 [1084] Warning: Automatic variable
> {case1:wapp=0;break;};*risultato is allocated
> 0.03026306 [1084]  script.c(31)
> 0.03033374 [1084] Error: improper lvalue
> 0.03044800 [1084]  script.c(31)
> 0.03053181 [1084] !!!Dictionary position rewound...
> 0.03156239 [1084] !!!Error recovered!!!
> 18.88892583 [1084] Closing DLL ..
>
>
> If I change to '*risultato = 1.0*dato;' i receive the error:
> [2248] Error: Symbol dato;} is not defined in current scope
>
>
> Thanks, regards
> --
> Ing. Stefano Mora
>
>
> ----- Original Message -----
> From: "Axel Naumann" <Axel.Naumann@...>
> To: "Stefano Mora - Eos S.r.l." <smora@...>
> Cc: <cint@...>
> Sent: Thursday, August 30, 2007 12:06 PM
> Subject: Re: [CINT] Returning values via pointers
>
>
>> Hi Stefano,
>>
>> Stefano Mora - Eos S.r.l. wrote:
>>> Hi, thanks again !
>>> Yes, it works.
>>> Now the script is:
>>>
>>> void formule(unsigned char finest, unsigned char voces, unsigned short
>>> formula, unsigned short dato, float*risultato, unsigned char*change)
>>> {
>>>  float fapp;
>>>  unsigned short wapp = dato;
>>>  switch(formula)
>>>  {
>>>   #include "fb4.h"
>>>  };
>>> }
>>>
>>> My debug log is:
>>>
>>> Init DLL ..
>>> [1776] Loading ok
>>> [1776] VB_FnStr1
>>> [1776] VB_FnStr2
>>> [1776] Note: File "script.c" already loaded
>>> [1776] formule( 0, 0, 10, 600, (float*)0x12f5cc, (unsigned
> char*)0x12f5dc);
>>> [1776] Error: Unexpected EOF G__fgetstream():2
>>> [1776]  script.c(103)
>>> [1776] Error: Function
>>>
> {case1:fapp=3.0+dato*0.1;break;case2:fapp=50.0+dato*0.78;break;case3:if(dato
> 0)fapp=STR_ONOFF_ON;elsefapp=STR_ONOFF_OFF;break;case4:fapp=dato;break;case
> 6:if(dato&0x01)fapp=STR_ONOFF_OFF;elsefapp=STR_ONOFF_ON;break;case7:if(dato&
> 0x1)fapp=STR_ONOFF_OFF;elsefapp=STR_ONOFF_ON;break;case9:fapp=dato*0.068;bre
> ak;case10:fapp=dato*0.25;break;case11:fapp=dato*0.39;break;case12:fapp=dato*
> 0.8;break;case13:fapp=dato*20;break;case14:fapp=dato*23;break;case15:fapp=da
> to*5;break;case16:if(dato&0x01)fapp=STR_ONOFF_ON;elsefapp=STR_ONOFF_OFF;brea
>>> k;};} is not defined in current scope
>>> 00000029 231.57850816 [1776]  script.c(103)
>>>
>>> What does it mean? (The text in the brackets are the content of fb2.h)
>> The switch statement should not contain a nested block outside the case
>> labels. I.e. you have
>> switch (formula)
>> {
>>   { // <--- no nested block
>>      { case 1: ...
>>      }; // <--- no semicolon!
>>   }; // <--- no nested block, no semicolon
>> };
>>
>> Instead use:
>> switch (formula)
>> {
>>   case 1: ...
>> };
>>
>> That means fb2.h should only contain
>>
>> case 1:...
>> case 2:...
>>
>> without surrounding '{' '}'.
>>
>>
>>> I'm not able to find the G__reload() !! In the include file are present
> only
>>> G__loadfile() and G__unloadfile().
>>> How can i reload/parse the script? Only G__loadfile() or better
>>> G__unloadfile() + G__loadfile ?
>> Calling G__unloadfile(), G__loadfile() should do it.
>>
>> Cheers, Axel.
>>
>>> --
>>> Ing. Stefano Mora
>>>
>>>
>>> ----- Original Message -----
>>> From: "Axel Naumann" <Axel.Naumann@...>
>>> To: "Stefano Mora - Eos S.r.l." <smora@...>
>>> Cc: <cint@...>
>>> Sent: Thursday, August 30, 2007 10:52 AM
>>> Subject: Re: [CINT] Returning values via pointers
>>>
>>>
>>>> Hi,
>>>>
>>>> you can use
>>>>
>>>> float res = 42.;
>>>> sprintf(buf, "formule(..., (float*)0x%x...)", &res);
>>>>
>>>> to "transmit" the pointer address from the calling code into CINT.
>>>>
>>>> Cheers, Axel.
>>>>
>>>>
>>>> Stefano Mora - Eos S.r.l. wrote:
>>>>> Hi all,
>>>>> i need to call a function in a script file from compiled C code via
>>>>> G__calc(...) function.
>>>>> The prototype of the function is:
>>>>>
>>>>> void formule(unsigned char finest,
>>>>>     unsigned char voces,
>>>>>     unsigned short formula,
>>>>>     unsigned short data,
>>>>>     float*res,
>>>>>     unsigned char*change)
>>>>>
>>>>> How can i build the call (from C to script) and how to handle the
>>> pointers
>>>>> on both side?
>>>>>
>>>>> Thanks !!
>>>>> --
>>>>> Ing. Stefano Mora
>>>>>
>>>>>
>>>>>
>>>
>
>


Error handling

by Stefano Mora - EOS S.r.l. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
is there a way to get an error code when a function fails or only its error
message?
Right now i explored;
    G__lasterror_linenum();
    G__lasterror_filename();
    G__set_errmsgcallback(p2f);
I'd like to handle, when possible, the errors in another way but i don't
know how to detect what happened but via errmsgcallback() function and error
messages.

Thanks!
--
Ing. Stefano Mora


Re: Error handling

by Axel Naumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Stefano,

you can use G__set_errmsgcallback(), or a construct like
   if ( G__get_return( 0 ) > G__RETURN_NORMAL )
      G__security_recover( 0 );    // 0 ensures silence
to silence CINT.

Cheers, Axel.

Stefano Mora - Eos S.r.l. wrote:

> Hi,
> is there a way to get an error code when a function fails or only its error
> message?
> Right now i explored;
>     G__lasterror_linenum();
>     G__lasterror_filename();
>     G__set_errmsgcallback(p2f);
> I'd like to handle, when possible, the errors in another way but i don't
> know how to detect what happened but via errmsgcallback() function and error
> messages.
>
> Thanks!
> --
> Ing. Stefano Mora
>
>


External preprocessor

by Stefano Mora - EOS S.r.l. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
me again :-)

How can i use a preprocessor different from the Microsoft one (cause
'cint -p')?
Is it possible? I'd like to use gcc instead of cl.exe  :-)

Regards
--
Ing. Stefano Mora


Re: External preprocessor

by Axel Naumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

you would get a clash e.g. for #ifdef _MSCVER, so the preprocessor must
match your compiler. But you can use GCC on windows, see cygwin and
Mingw. Though they are both a lot slower than cl, both in compiling and
in the code they create.

Cheers, Axel.

Stefano Mora - Eos S.r.l. wrote:

> Hi,
> me again :-)
>
> How can i use a preprocessor different from the Microsoft one (cause
> 'cint -p')?
> Is it possible? I'd like to use gcc instead of cl.exe  :-)
>
> Regards
> --
> Ing. Stefano Mora
>
>


Re: External preprocessor

by Stefano Mora - EOS S.r.l. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
i'm not sure to understand ...
On runtime I need to have the same precompiler used to compile CInt.exe and
its dll?
So, the one you have on the site is compiled with MSVC, so it looks for
cl.exe.
If i compile CInt exe+lib with MinGW, it will look for gcc (or similar) ??

Thanks
--
Ing. Stefano Mora
EOS S.r.l.
via Monte Aquila, 2
43100 Corcagnano (Parma) IT
email: smora@...


----- Original Message -----
From: "Axel Naumann" <Axel.Naumann@...>
To: "Stefano Mora - Eos S.r.l." <smora@...>
Cc: <cint@...>
Sent: Friday, August 31, 2007 5:55 PM
Subject: Re: [CINT] External preprocessor


> Hi,
>
> you would get a clash e.g. for #ifdef _MSCVER, so the preprocessor must
> match your compiler. But you can use GCC on windows, see cygwin and
> Mingw. Though they are both a lot slower than cl, both in compiling and
> in the code they create.
>
> Cheers, Axel.
>
> Stefano Mora - Eos S.r.l. wrote:
> > Hi,
> > me again :-)
> >
> > How can i use a preprocessor different from the Microsoft one (cause
> > 'cint -p')?
> > Is it possible? I'd like to use gcc instead of cl.exe  :-)
> >
> > Regards
> > --
> > Ing. Stefano Mora
> >
> >


Re: Error handling

by Stefano Mora - EOS S.r.l. :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks !
I guess that  G__get_return() returns the error codes coded as G__RETURN_*
but:
- it is documented somewhere?
- the mean of the G__get_return(x) parameter ?
- i think these values are generic error code, so i'm not able to have an
error code that describes exaclty what happen, is it?

Thansk again !!
--
Ing. Stefano Mora


----- Original Message -----
From: "Axel Naumann" <Axel.Naumann@...>
To: "Stefano Mora - Eos S.r.l." <smora@...>
Cc: <cint@...>
Sent: Friday, August 31, 2007 3:00 PM
Subject: Re: [CINT] Error handling


> Hi Stefano,
>
> you can use G__set_errmsgcallback(), or a construct like
>    if ( G__get_return( 0 ) > G__RETURN_NORMAL )
>       G__security_recover( 0 );    // 0 ensures silence
> to silence CINT.
>
> Cheers, Axel.
>
> Stefano Mora - Eos S.r.l. wrote:
> > Hi,
> > is there a way to get an error code when a function fails or only its
error
> > message?
> > Right now i explored;
> >     G__lasterror_linenum();
> >     G__lasterror_filename();
> >     G__set_errmsgcallback(p2f);
> > I'd like to handle, when possible, the errors in another way but i don't
> > know how to detect what happened but via errmsgcallback() function and
error
> > messages.
> >
> > Thanks!
> > --
> > Ing. Stefano Mora
> >
> >


Re: External preprocessor

by Axel Naumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Stefano,

Stefano Mora - Eos S.r.l. wrote:
> i'm not sure to understand ...
> On runtime I need to have the same precompiler used to compile CInt.exe and
> its dll?
> So, the one you have on the site is compiled with MSVC, so it looks for
> cl.exe.
> If i compile CInt exe+lib with MinGW, it will look for gcc (or similar) ??

Correct.

Cheers, Axel.

> Thanks
> --
> Ing. Stefano Mora
> EOS S.r.l.
> via Monte Aquila, 2
> 43100 Corcagnano (Parma) IT
> email: smora@...
>
>
> ----- Original Message -----
> From: "Axel Naumann" <Axel.Naumann@...>
> To: "Stefano Mora - Eos S.r.l." <smora@...>
> Cc: <cint@...>
> Sent: Friday, August 31, 2007 5:55 PM
> Subject: Re: [CINT] External preprocessor
>
>
>> Hi,
>>
>> you would get a clash e.g. for #ifdef _MSCVER, so the preprocessor must
>> match your compiler. But you can use GCC on windows, see cygwin and
>> Mingw. Though they are both a lot slower than cl, both in compiling and
>> in the code they create.
>>
>> Cheers, Axel.
>>
>> Stefano Mora - Eos S.r.l. wrote:
>>> Hi,
>>> me again :-)
>>>
>>> How can i use a preprocessor different from the Microsoft one (cause
>>> 'cint -p')?
>>> Is it possible? I'd like to use gcc instead of cl.exe  :-)
>>>
>>> Regards
>>> --
>>> Ing. Stefano Mora
>>>
>>>
>
>


Re: Error handling

by Axel Naumann :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Stefano,

you could redirect the error message and parse it. Improving the error
handling is on our to-do list, but it's not very high priority. The
function G__get_return() is indeed not properly documented; we will
change that with the next major version (7) of CINT.

Cheers, Axel.

Stefano Mora - Eos S.r.l. wrote:

> Thanks !
> I guess that  G__get_return() returns the error codes coded as G__RETURN_*
> but:
> - it is documented somewhere?
> - the mean of the G__get_return(x) parameter ?
> - i think these values are generic error code, so i'm not able to have an
> error code that describes exaclty what happen, is it?
>
> Thansk again !!
> --
> Ing. Stefano Mora
>
>
> ----- Original Message -----
> From: "Axel Naumann" <Axel.Naumann@...>
> To: "Stefano Mora - Eos S.r.l." <smora@...>
> Cc: <cint@...>
> Sent: Friday, August 31, 2007 3:00 PM
> Subject: Re: [CINT] Error handling
>
>
>> Hi Stefano,
>>
>> you can use G__set_errmsgcallback(), or a construct like
>>    if ( G__get_return( 0 ) > G__RETURN_NORMAL )
>>       G__security_recover( 0 );    // 0 ensures silence
>> to silence CINT.
>>
>> Cheers, Axel.
>>
>> Stefano Mora - Eos S.r.l. wrote:
>>> Hi,
>>> is there a way to get an error code when a function fails or only its
> error
>>> message?
>>> Right now i explored;
>>>     G__lasterror_linenum();
>>>     G__lasterror_filename();
>>>     G__set_errmsgcallback(p2f);
>>> I'd like to handle, when possible, the errors in another way but i don't
>>> know how to detect what happened but via errmsgcallback() function and
> error
>>> messages.
>>>
>>> Thanks!
>>> --
>>> Ing. Stefano Mora
>>>
>>>
>
>

LightInTheBox - Buy quality products at wholesale price