SA-MP S[D]K
#1

What is this?
This is an implementation of the SA-MP SDK for the systems programming language D (http://dlang.org/). D's aim is safe memory operations, and it's one of my favourite languages right now.

The SDK is in an early stage, and only works on Windows right now (though, most of the SDK is implemented).

How do I use this?
If you're using Visual Studio, you can download Visual D (https://rainers.github.io/visuald/vi...StartPage.html) and simply open the project provided below.

Is that all
Nope, there's an example and some tests in the ExamplePlugin/dllmain.d file, and I'll be adding more information about it as I go.

Where do I download it?
There aren't any binaries (seeing as it's an SDK), but the source code is on GitHub.


One more thing:
Please report any bugs you find using the GitHub issue tracker.
Reply
#2

Interesting way of naming "S[D]K". Very well done.
Reply
#3

Looks great!

Waiting for the LISP SDK!
Reply
#4

What about support for functions/callbacks from other plugins ?
Reply
#5

Quote:
Originally Posted by Kaperstone
Посмотреть сообщение
What about support for functions/callbacks from other plugins ?
The SDK can take care of that - just like in the C SDK, there are Native/Callback functions.
Reply
#6

Very Nice
Reply
#7

Pushed a new update: Added exception handling

The functions now throw an AmxException that contains the error type, and error description as a string.
Most out values replaced by return values (you don't need to declare a variable before calling the functions).
Reply
#8

While trying to compile, I get the following error:
Код:
Error: cannot pass dynamic arrays to extern© vararg functions
It shows up in this code:
pawn Код:
catch(AmxException e)
{
    LogPrintf("Could not register natives with AMX: %s", e.getErrorString());
    return e.getError();
}
Exactly:
Код:
	LogPrintf("Could not register natives with AMX: %s", e.getErrorString());
How to fix it? I use Visual Studio 2013 Community Edition, I have VisualD and the compiler installed, and the only thing that worries me is this one error above.
Reply
#9

Quote:
Originally Posted by Dystans
Посмотреть сообщение
While trying to compile, I get the following error:
Код:
Error: cannot pass dynamic arrays to extern© vararg functions
It shows up in this code:
pawn Код:
catch(AmxException e)
{
    LogPrintf("Could not register natives with AMX: %s", e.getErrorString());
    return e.getError();
}
Exactly:
Код:
	LogPrintf("Could not register natives with AMX: %s", e.getErrorString());
How to fix it? I use Visual Studio 2013 Community Edition, I have VisualD and the compiler installed, and the only thing that worries me is this one error above.
Try changing "e.getErrorString()" to "e.getErrorString().ptr". I'll be adding a LogPrintf function that supports D arrays, but for now you have to pass a pointer. It's odd my compiler didn't notice that as yours did, though.
Reply
#10

Quote:
Originally Posted by iZN
Посмотреть сообщение
Interesting way of naming "S[D]K". Very well done.
Lol good point
Reply
#11

Added Linux (and any Posix, GNU system) support - the SDK is now cross-compatible.
Added an example Unix makefile.
Reply
#12

Thanks for adding ganoo support.
Reply
#13

This should really be set as a sticky I would recommend taking the same approach as the SAMP development tutorial that is also a sticky but instead focus solely on D.
Reply
#14

Quote:
Originally Posted by Pottus
Посмотреть сообщение
This should really be set as a sticky I would recommend taking the same approach as the SAMP development tutorial that is also a sticky but instead focus solely on D.
Yeah, I'll surely be making a D plugin development guide.


New update:
I replaced most of the code with object-oriented one to minimise the amount of functions the end-user has to call to initialize the plugin.

(https://github.com/KingHual/SA-MP-S-.../dllmain.d#L73)


amxRegister now automatically appends NULL to the passed array, so the end-user doesn't need to have NULL as the last element of the array.

(https://github.com/KingHual/SA-MP-S-...main.d#L64-L67)
Reply
#15

Thanks for this!
Reply
#16

There is any D plugin development guide?
Reply


Forum Jump:


Users browsing this thread: