pawn-lang/compiler

External natives are always in the header, even when not used.

Y-Less opened this issue · 2 comments

Issue description:

If you declare a native with an external name (i.e. native A() = B;) it is placed in the AMX native functions header even if never used.

Minimal complete verifiable example (MCVE):

native MyHeapspace() = heapspace;
main()
{
}

That should have nothing in the natives table. It doesn't.

Workspace Information:

  • Compiler version:
  • Command line arguments provided (or sampctl version):
  • Operating System:

OK that MCVE might not be accurate. I just realised that all the ones I was seeing were used in SYSREQ.C in code that isn't itself called:

native MyHeapspace() = heapspace;
stock NotUsed()
{
    __emit(PUSH.C 0, SYSREQ.C MyHeapspace(), STACK 4);
}

main()
{
}

For some reason I can't edit:

native MyHeapspace() = heapspace;
stock NotUsed()
{
    __emit(PUSH.C 0, SYSREQ.C MyHeapspace, STACK 4);
}

main()
{
}