Honestly, this is not specifically related to Source SDK. But, I need help, and desperate... Sorry...
I am trying to export/import global variables in a Windows Env. (Visual Studio 2010 Pro Ed)
I wrote the below code, which I think is correct. However, the value is not mirrored correctly to the EXE.
Furthermore, I am using a Game Mod, where the DLLs are located in a different folder than the EXE. So, I would like someone to tell me how to correctly type in the "Additional Dependency" option.
Last, I would like to know the correct syntax of this if I would port my code to Linux.
The code:
//DLL side #define __ZG_DLLEXPORT__ __declspec(dllexport) __ZG_DLLEXPORT__ int xyzzyx = -1; void smFunc() { if( xyzzyx < 10000 ) { xyzzyx += 4; } }/-----------------/
//Exe Side #define __ZG_DLLIMPORT__ __declspec(dllimport) __ZG_DLLIMPORT__ int xyzzyx; int XXXXX = 0; int IIII = 9; void funcX() { XXXXX = xyzzyx; if( XXXXX > 100 ) { fp = fopen("SOMETHING.txt", "a"); if( fp != NULL ) { fprintf(fp, "%d", XXXXX ); fprintf(fp, "\n" ); } fclose(fp); } }/---output---/ you can ignore the Additional Dependency, because I am not familiar with the proper syntax.
//Additional Dependency: Mod folder, which contains *.lib and *.dll files: //The value of xyzzyx is always -1, //Additional Dependency: Exe folder, the program crashes saying DLL is corrupt.
Edited by coffeenet, 15 December 2011 - 10:19 PM.