Problem
#1

I want to create a DLL that asks program for info and sends it to somewhere else. But when I call (static cell AMX_NATIVE_CALL) function, then it won't work anymore, because it cannot read or write protected memory. How to get rid of that?

Code:
char * Info;

static cell AMX_NATIVE_CALL n_SendServerInfo( AMX* amx, cell* params )
{
  char *szInfo;
  amx_StrParam(amx, params[1], szInfo);
  Info = szInfo;
  return true;
}
Reply
#2

Hi Blefish,

I had a similar problem, I can imagine you are using the "hello world" template.

This has provided a very good template for me and has enabled me to add my plugin natives with very little changes. The only downside would be that it does not provide an example of callback implementation.

I encountered a small compiling problem similar to yours.

try making the following changes in "amx.h" to see they rectify your problem.

Comment out the following if directive
Code:
/*#if defined __WIN32__ || defined _WIN32 || defined WIN32
 #if !defined alloca
  #define xalloca(n)  _alloca(n)
 #endif
#endif*/
and replace it with this one;

Code:
#if HAVE_ALLOCA_H
 #include <alloca.h>
#endif
Reply
#3

Hi Blefish,

I had a similar problem, I can imagine you are using the "hello world" template.

This has provided a very good template for me and has enabled me to add my plugin natives with very little changes. The only downside would be that it does not provide an example of callback implementation.

I encountered a small compiling problem similar to yours.

try making the following changes in "amx.h" to see they rectify your problem.

Comment out the following if directive
Code:
/*#if defined __WIN32__ || defined _WIN32 || defined WIN32
 #if !defined alloca
  #define xalloca(n)  _alloca(n)
 #endif
#endif*/
and replace it with this one;

Code:
#if HAVE_ALLOCA_H
 #include <alloca.h>
#endif
Edit:

If this resolves the issue, would you kindly change the topic to something along the lines off, "alloca problem" for future reference.
Reply
#4

Hi Blefish,

I had a similar problem, I can imagine you are using the "hello world" template.

This has provided a very good template for me and has enabled me to add my plugin natives with very little changes. The only downside would be that it does not provide an example of callback implementation.

I encountered a small compiling problem similar to yours.

try making the following changes in "amx.h" to see they rectify your problem.

Comment out the following if directive
Code:
/*#if defined __WIN32__ || defined _WIN32 || defined WIN32
 #if !defined alloca
  #define xalloca(n)  _alloca(n)
 #endif
#endif*/
and replace it with this one;
Code:
#if HAVE_ALLOCA_H
 #include <alloca.h>
#endif
Edit:
If this resolves the issue, would you kindly change the topic to something along the lines of, "alloca problem" for future reference.
Reply
#5

It didn't solve my problem. I want to get string from server, server sends it to dll, dll sends it to program.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)