logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
nwnx events - Fastcall RunScript version?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Mar 22, 2011 12:54    Post subject: nwnx events - Fastcall RunScript version? Reply with quote

Hey Maxrock,
Dont know if you remember this thread
http://www.nwnx.org/phpBB2/viewtopic.php?t=1615

But the reason that nwnx events was crashing the server in that instance was something to do with incompatabilities with fastcall hooks, working with the non-fastcall implimentation of run script or something.#

You gave me code to get the Fast Call implimentation of run script working,
however I lost it... - I got latest svn and it overwrote it.

Any chance you would have that code snippet lying around, or maybe even anyone having an updated events src that uses fast call, opposed to asm calls?

Got myself some new ideas for hooks I wana try, but I havent done any hooking since I lost my version of events.

Ideas such as
Hooking Transitions (get origin area and Destination Area - more logging?)
Re-Hooking the player attitude changes etc - Had this done, but lost the source.
Pause Event & Blocking (Had this done, but lost the source)
Player Login Hook (Hook onto the event that fires on player joining server, but not entering the gameworld - eg Character Creation screen)
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Tue Mar 22, 2011 17:15    Post subject: Reply with quote

All the thiscall functions in the nwn_internal files http://nwn.virusman.ru/trac/nwnx2-win32/browser/branches/maxrock/nwn_internals can be turned into __fastcall hooks very easily; if they're in there of course.

CVirtualMachine.cpp
Code:

int (__thiscall *CVirtualMachine__RunScript)(CVirtualMachine *pTHIS, CExoString *a2, nwn_objid_t, int a4) = (int (__thiscall*)(CVirtualMachine *pTHIS, CExoString *a2, nwn_objid_t, int a4))0x005BF9D0;


Get rid of everything after the '=' (remember the address, change __thiscall into __fastcall and insert a void parameter after the first one (which in a real member function would implicitly be the this pointer) and you have your "Next" function pointer.

Code:

int (__fastcall *CVirtualMachine__RunScriptNEXT)(CVirtualMachine *pTHIS, void *pVOID, CExoString *a2, nwn_objid_t a3, int a4);


The rest is pretty much copy and paste, and a few name changes (NEXT, HOOK, ORG suffixes)
Code:

int __fastcall *CVirtualMachine__RunScriptHOOK(CVirtualMachine *pTHIS, void *pVOID, CExoString *a2, nwn_objid_t a3, int a4) {
   return CVirtualMachine__RunScriptNEXT(pTHIS, NULL, a2, a3, a4);
}

Code:

DWORD CVirtualMachine__RunScriptORG = 0x005BF9D0;
HookCode((PVOID) org_CVirtualMachine__RunScriptORG, CVirtualMachine__RunScriptHOOK, (PVOID*)&nwn_CVirtualMachine__RunScriptNEXT);

}

Hope that helps.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Mar 22, 2011 17:51    Post subject: Reply with quote

Ok, so the current method of implimentation in nwnx events is

Code:

void RunScript(char * sname, int ObjID)
{
  int sptr[4];
  sptr[1] = strlen(sname);
  _asm {
    lea  edx, sptr
    mov  eax, sname
    mov  [edx], eax
    push 1
    push ObjID
    push edx
    mov ecx, pScriptThis
    mov ecx, [ecx]
  }
  scriptRun = 1;
  pRunScript();
  scriptRun = 0;
}




for the definition of the function
we would change it to mirror what you have below?
With some minor changes etc


- Im in work, I will work on this tonight. hehe
Without VS2008 infront of me, its hard to know what im talking about.
Back to top
View user's profile Send private message
motu99



Joined: 24 Sep 2007
Posts: 16

PostPosted: Tue Mar 22, 2011 18:07    Post subject: Reply with quote

EDIT: writing this up took too long, MaxRock beat me.... Nevertheless:

Why don't you use thiscall?

(Almost) all the class member-functions in nwserver.exe are compiled with the __thiscall calling convention. [Almost, because functions with variable nr of arguments usually are incompatible with the __thiscall, __stdcall or __fastcall calling conventions, they are called with cdecl]. To my knowledge the __fastcall calling convention is not used in nwserver.exe (at least I haven't seen any such occurrence so far).

a function declared with __fastcall, such as:
Code:

int __fastcall myFastCall(int arg_ecx, int arg_edx [,any_other_args])


assumes that the first argument is in ecx, the second in edx and any other arguments on the stack (in reverse order).

a function declared with __thiscall, such as:
Code:

int __thiscall myThisCall(int arg_ecx [,any_other_args])


assumes that the first argument (usually the this-pointer) is in ecx and any other arguments on the stack

Now, when you declare a function as __fastcall (although within nwserver it is actually __thiscall, because this is what MS Visual C++ 6 used for class member functions when Bioware built nwserver.exe), you MIGHT mess up the edx register. Why? Because the caller of your myFastCall-function will put the arg_edx into edx (the "standard" procedure in nwnx-hooking is to set arg_edx to NULL, but in principle you can pass any garbage into the edx register).

Now putting garbage (be it NULL or any other value) into the edx register usually isn't a problem: The MS-compilers (in this case MS Visual C++ 6) implicitly assume that functions called with __thiscall (or __fastcall or __stdcall) mess up the eax, ecx and edx registers. [any function return values are passed back to the caller in eax (or eax:edx for 64-bit return values)]. So messing up the edx register when the functions starts up shouldn't be a problem.

However, with optimizing compilers you never know.

So in my opinion __thiscall is preferable over __fastcall.

Yet, if you still want to use __fastcall, just take MaxRocks __thiscall implementation of RunScript:

Code:

int (__thiscall *CVirtualMachine__RunScript)(CVirtualMachine *pTHIS, CExoString *a2, nwn_objid_t, int a4) = (int (__thiscall*)(CVirtualMachine *pTHIS, CExoString *a2, nwn_objid_t, int a4))0x005BF9D0;


and change it to:

Code:

int (__fastcall *CVirtualMachine__RunScript)(CVirtualMachine *pTHIS, void* garbage, CExoString *a2, nwn_objid_t, int a4) = (int (__fastcall*)(CVirtualMachine *pTHIS, void* garbage, CExoString *a2, nwn_objid_t, int a4))0x005BF9D0;


Last edited by motu99 on Tue Mar 22, 2011 18:38; edited 2 times in total
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Mar 22, 2011 18:22    Post subject: duh Reply with quote

Duhh
I shoulda read over the replies in that topic more in depth.

Code:

signed int(__fastcall *RunScript_Next)(void*, void*, CExoString*, int, int);
signed int __fastcall RunScript_Hook(void *pThis, void *pVOID, CExoString *ScriptName, int a3, int a4) {
   return RunScript_Next(pThis, NULL, ScriptName, a3, a4);
}



I think this is what I was needing.
I remember the night I was working on this, took me ages to get that nwnx_events dll to work.
I think this is what I was needing.
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Tue Mar 22, 2011 21:20    Post subject: Reply with quote

motu99 wrote:

So in my opinion __thiscall is preferable over __fastcall.


It would also be less typing Laughing

I believe Baaleos and I have similar hobby programmer backgrounds, and
the reason we're using fastcall is because we were shown that "trick" to get around doing assembly and we just stuck to it because it worked. (I've learned more about c++ and compilers working on nwnx than in 2 years of software engineering)

Not wanting to be learn resistant, I've just tried some hooks with thiscall and they work perfectly fine. So, yay to less typing. Thanks for the tip, motu99.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Mar 22, 2011 21:35    Post subject: Reply with quote

I'm in Same boat as Max.
Not learn resistant, but C++ being hard enough to learn, assembly is also a headache to learn.

The fastcall method does allow alot of accomplishment with little to no prior knowledge of asm required.

Everything I know about c++ came from nwnx.
Wish it was more like c#.
Back to top
View user's profile Send private message
motu99



Joined: 24 Sep 2007
Posts: 16

PostPosted: Wed Mar 23, 2011 0:21    Post subject: Reply with quote

MaxRock wrote:
I've learned more about c++ and compilers working on nwnx than in 2 years of software engineering.


Same with me.

I did some assembly language programming (with a Motorola 680x0) and learned C almost 20 years ago. Learned C++ at that time, too, but didn't use it.

Recently I started refreshing my programming skills (assembly, C++) in order to hook CNWSCreature::AddCastSpellActions(). 80x86-Assembly through a book and C++ by studying some (or rather many) lines of nwnx C++ source code. Guess who's plugin is was? funcs! I am pretty impressed with what you achieved for nwnx-win32 in such a relatively short time.

My knowledge of 80x86 assembly and C++ is still quite theoretical. Understanding how things work in principle, and writing substantial amounts of code that compiles and does whats intended are two different things (Curiously, at the moment I am probably better at assembly than I am in C++). So don't take my rantings as the bible.

As long as Visual C++ 6 didn't optimize the nwserver code across function boundaries (most likely not), fastcall or thiscall are pretty much equivalent and safe to use. Well, fastcall - in the context of hooking nwserver member-functions - is the "rich man's" thiscall: It does the same thing as thiscall but additionally places some garbage in the edx register. Laughing [The performance decrease of fastcall over thiscall is negligble: If the compiler is smart, it will add an "xor edx,edx" before calling the function]
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Mar 23, 2011 1:30    Post subject: Blah!! Reply with quote

Visual Studio 2008 is doing my head in.

Keeps giving me errors about undefined identifiers, or about afxres.h not being usable (I can get rid of the latter error by changing that to be window.h)

At this point, it builds.

When I try to add CVirtualMachine class to the project, it goes mental.
Says that
Quote:

\events src\nwn_internals\cvirtualmachine.cpp(1) : fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory


I've got this file added to project, I can open it, the path to it is correct etc
I've tried both this
#include "../NWNXdll/StdAfx.h"
and
#include "StdAfx.h"

as well as copying it locally etc


Keeps erroring out on me.

My hope is that I can simply call the VirtualMachine->RunScript method, meaning I dont need to hook anything at all.
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Wed Mar 23, 2011 3:06    Post subject: Reply with quote

Is your project using precompiled headers? That's what the stdafx.h pretty much is and it's usually looking for it in the main directory; if you can see it in the solution explorer under Header Files you should be fine.

...I'm also not using "good" oop programming so everything gets kinda cross included at some point...

In project settings->c/c++ make sure you have the include directory (from nwnx funcs) in "Additional Include Directories".
Then include types.h in your main header file, and drag-and-drop CVirtualMachine.cpp into "Source Files" in Solution Explorer (I think that does the same thing as Add->Existing Item).
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Zebranky



Joined: 04 Jun 2006
Posts: 415

PostPosted: Wed Mar 23, 2011 11:49    Post subject: Reply with quote

I still use __fastcall because __thiscall does not, IIRC, work in Visual Studio 6, which I still consider a supported build platform. (Besides that, __fastcall makes me feel a bit more in control. Smile)
_________________
Win32 SVN builds: http://www.mercuric.net/nwn/nwnx/

<Fluffy-Kooshy> NWNx plugin is to this as nuclear warheads are to getting rid of fire ants.

<ThriWork> whenever I hear nwn extender, I think what does NWN need a penis extender for?
Back to top
View user's profile Send private message Visit poster's website
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sun Mar 27, 2011 21:58    Post subject: still having problems with building Reply with quote

When I add the VirtualMachine class, and build with the types.h header included in the main header (nwnxEvents.h) I get the following errors.

Quote:

1>Deleting intermediate and output files for project 'Events', configuration 'Debug|Win32'
1>Compiling...
1>Events.cpp
1>HookFunc.cpp
1>IniFile.cpp
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\nwnxdll\inifile.cpp(52) : warning C4996: 'stricmp': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(215) : see declaration of 'stricmp'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\nwnxdll\inifile.cpp(70) : warning C4996: 'stricmp': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(215) : see declaration of 'stricmp'
1>NWNXBase.cpp
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\nwnxdll\nwnxbase.cpp(53) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\string.h(207) : see declaration of 'strdup'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\nwnxdll\nwnxbase.cpp(54) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(237) : see declaration of 'fopen'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\nwnxdll\nwnxbase.cpp(82) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(237) : see declaration of 'fopen'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\nwnxdll\nwnxbase.cpp(89) : warning C4996: 'vsprintf': This function or variable may be unsafe. Consider using vsprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(366) : see declaration of 'vsprintf'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\nwnxdll\nwnxbase.cpp(115) : warning C4996: '_vsnprintf': This function or variable may be unsafe. Consider using _vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(358) : see declaration of '_vsnprintf'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\nwnxdll\nwnxbase.cpp(132) : warning C4996: '_strtime': This function or variable may be unsafe. Consider using _strtime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\time.h(192) : see declaration of '_strtime'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\nwnxdll\nwnxbase.cpp(133) : warning C4996: '_strdate': This function or variable may be unsafe. Consider using _strdate_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\time.h(188) : see declaration of '_strdate'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\nwnxdll\nwnxbase.cpp(137) : warning C4996: '_vsnprintf': This function or variable may be unsafe. Consider using _vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(358) : see declaration of '_vsnprintf'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\nwnxdll\nwnxbase.cpp(155) : warning C4996: '_strtime': This function or variable may be unsafe. Consider using _strtime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\time.h(192) : see declaration of '_strtime'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\nwnxdll\nwnxbase.cpp(156) : warning C4996: '_strdate': This function or variable may be unsafe. Consider using _strdate_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\time.h(188) : see declaration of '_strdate'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\nwnxdll\nwnxbase.cpp(160) : warning C4996: '_vsnprintf': This function or variable may be unsafe. Consider using _vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(358) : see declaration of '_vsnprintf'
1>NWNXEvents.cpp
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\events src\nwnxevents.cpp(44) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(366) : see declaration of 'sprintf'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\events src\nwnxevents.cpp(84) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(366) : see declaration of 'sprintf'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\events src\nwnxevents.cpp(107) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(366) : see declaration of 'sprintf'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\events src\nwnxevents.cpp(117) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(366) : see declaration of 'sprintf'
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\events src\nwnxevents.cpp(126) : warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\stdio.h(366) : see declaration of 'sprintf'
1>CVirtualMachine.cpp
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(95) : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(96) : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(97) : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(9Cool : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(99) : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(100) : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(101) : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(102) : error C3861: 'realloc': identifier not found


The Lines of code it objects to in the cexoarraylist.h are
Quote:

NX_NWN_CEXOARRAYLIST_CONTAINS(int8, int8_t)
NX_NWN_CEXOARRAYLIST_CONTAINS(int32, int32_t)
NX_NWN_CEXOARRAYLIST_CONTAINS(uint8, uint8_t)
NX_NWN_CEXOARRAYLIST_CONTAINS(uint16, uint16_t)
NX_NWN_CEXOARRAYLIST_CONTAINS(uint32, uint32_t)
NX_NWN_CEXOARRAYLIST_CONTAINS(uint64, uint64_t)
NX_NWN_CEXOARRAYLIST_CONTAINS(float, float)
NX_NWN_CEXOARRAYLIST_CONTAINS(ptr, void *)
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Mon Mar 28, 2011 16:24    Post subject: Reply with quote

You can pretty much ignore the warnings - at least for now. Or add
#define _CRT_SECURE_NO_WARNINGS to stdafx.h to make them go away

I think realloc is in malloc.h, so if you include that in stdafx.h as well it should work. (Rebuild the project after including it.)


EDIT:
#pragma warning(disable : 4996)
might actually work better than _CRT_SECURE_NO_WARNINGS
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Mon Mar 28, 2011 21:50    Post subject: Reply with quote

Code:

// stdafx.h : include file for standard system include files,
//  or project specific include files that are used frequently, but
//      are changed infrequently
//

#if !defined(AFX_STDAFX_H__E7E6709E_702D_4A4D_BB3B_BF980D1F40E6__INCLUDED_)
#define AFX_STDAFX_H__E7E6709E_702D_4A4D_BB3B_BF980D1F40E6__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


// Insert your headers here
#define WIN32_LEAN_AND_MEAN      // Exclude rarely-used stuff from Windows headers


#include <windows.h>
#include <stdlib.h>
#include <malloc.h>


// TODO: reference additional headers your program requires here

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_STDAFX_H__E7E6709E_702D_4A4D_BB3B_BF980D1F40E6__INCLUDED_)




Included it, but no joy.
Still get this


Quote:

1>------ Rebuild All started: Project: Events, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'Events', configuration 'Debug|Win32'
1>Compiling...
1>Events.cpp
1>HookFunc.cpp
1>IniFile.cpp
1>NWNXBase.cpp
1>NWNXEvents.cpp
1>CVirtualMachine.cpp
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(95) : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(96) : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(97) : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(9Cool : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(99) : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(100) : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(101) : error C3861: 'realloc': identifier not found
1>c:\documents and settings\administrator.jpc.003\desktop\nwnx2-win32\branches\maxrock\include\cexoarraylist.h(102) : error C3861: 'realloc': identifier not found
1>Generating Code...
1>Build log was saved at "file://c:\Documents and Settings\Administrator.JPC.003\Desktop\nwnx2-win32\branches\events src\Debug\BuildLog.htm"
1>Events - 8 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========



Oh, thats odd
When I put
#include <malloc.h>

inside the cexoarraylist.h then it builds...


Still get problems with this
Quote:

1>Deleting intermediate and output files for project 'Events', configuration 'Debug|Win32'
1>Compiling...
1>Events.cpp
1>HookFunc.cpp
1>IniFile.cpp
1>NWNXBase.cpp
1>NWNXEvents.cpp
1>CVirtualMachine.cpp
1>Generating Code...
1>Compiling resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Linking...
1> Creating library .\Debug/nwnx_events.lib and object .\Debug/nwnx_events.exp
1>HookFunc.obj : error LNK2001: unresolved external symbol "struct CVirtualMachine_s * * NWN_VirtualMachine" (?NWN_VirtualMachine@@3PAPAUCVirtualMachine_s@@A)
1>Debug/nwnx_events.dll : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Documents and Settings\Administrator.JPC.003\Desktop\nwnx2-win32\branches\events src\Debug\BuildLog.htm"
1>Events - 2 error(s), 0 warning(s)



Happens when I try to use
Code:

(*NWN_VirtualMachine)->Runscript((CExoString *)sname, ObjID);
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Tue Mar 29, 2011 4:37    Post subject: Reply with quote

Try adding CVirtualMachine.cpp to your project.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development All times are GMT + 2 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group