[Vm-dev] Newbie questions about non-static, static and EXPORT

Igor Stasenko siguctua at gmail.com
Wed Apr 13 20:05:45 UTC 2011


On 13 April 2011 22:39, Mariano Martinez Peck <marianopeck at gmail.com> wrote:
>
> Hi folks, I am trying to understand them. What I understood so that is that from SLANG we can say:
>
> <export: true>   ----> it will add the keyword EXPORT(sqInt) functXX();
>
> <api>    ---->   it WONT put the static prefix  ->>    (sqInt) funcXXX()
>
> if nothing is said    ->   it puts the static   ->>  static (sqInt)   functXXX()
>
> If I understood correctly, static functions are not callable outside of the C file they are defined in. So, if you don't put static, then they are callable.
>
> I am correct with all that ?
>
I think yes. But i'm not sure about <api> since it was introduced in
Cog and i haven't time to check what exactly it does.

> So..first question, why we need the this ?   when I should declare a function/method as API ? is it possible that this is when plugins need to call a function from the VM ?
>
> Second, when should I need to declare a method/function as EXPORT ? Are there any other reason that being able to call them from GDB ?
>
> Third, why there are methods which do not put the <export: true>    but in fact are added in #requiredMethodNames and hence exported.   Why they cannot have the <export: true>   instead of being hardcoded there?

to prevent them from being fully inlined and removed from source code
as a separate function.

>
> Thanks a lot in advance,
>
> --
> Mariano
> http://marianopeck.wordpress.com
>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Vm-dev mailing list