C++ API 2.3 Causing Access Violation Errors

I have a server add-in program I wrote using the 2.1 C++ API which works great under R5. I recompiled it using the 2.3 BETA API and it runs great under R6 & R6.01… When I recompiled it using the 2.3 RELEASED API, my program is triggering NSD which reports ACCESS VIOLATION errors. Here’s the weird part. If I compile using the 2.3 RELEASE API with MSVC++ 6.0 using an Win32-Debug configuration in my IDE, the add-in runs just fine. If I compile using the Win32-Release configuration, the add-in crashes with the ACCESS VIOLATION error. If I use the 2.3 BETA API, I can compile with the Win32-Debug and the Win32-Release configurations and the add-in will run without error…

Has anyone else experienced this or can anyone offer any ideas of how to approach solving this problem?

Thanks,

Dave

Subject: C++ API 2.3 Causing Access Violation Errors

Hi David,

I’m part of the C++ API development team,

what are your compiler/linker settings (they’re probably correct…but that’s a start.)?

also, does the sample addinjob compiled with the default options crash?

Subject: RE: C++ API 2.3 Causing Access Violation Errors

Steve,

Here’s the makefile for project. Will this help?

I’m checking if the addinjob works…

Just a note, though. If I add 5 strategically placed “cout << “### 1 ###” << endl;” statements in code, it will run correctly… Take them out and it crashes…

Something fundamental HAD to have changed between the BETA and RELEASE versions of the API…

Microsoft Developer Studio Generated NMAKE File, Based on ndc.dsp

!IF “$(CFG)” == “”

CFG=ndc - Win32 Debug

!MESSAGE No configuration specified. Defaulting to ndc - Win32 Debug.

!ENDIF

!IF “$(CFG)” != “ndc - Win32 Release” && “$(CFG)” != “ndc - Win32 Debug”

!MESSAGE Invalid configuration “$(CFG)” specified.

!MESSAGE You can specify a configuration when running NMAKE

!MESSAGE by defining the macro CFG on the command line. For example:

!MESSAGE

!MESSAGE NMAKE /f “ndc.mak” CFG=“ndc - Win32 Debug”

!MESSAGE

!MESSAGE Possible choices for configuration are:

!MESSAGE

!MESSAGE “ndc - Win32 Release” (based on “Win32 (x86) Console Application”)

!MESSAGE “ndc - Win32 Debug” (based on “Win32 (x86) Console Application”)

!MESSAGE

!ERROR An invalid configuration is specified.

!ENDIF

!IF “$(OS)” == “Windows_NT”

NULL=

!ELSE

NULL=nul

!ENDIF

!IF “$(CFG)” == “ndc - Win32 Release”

OUTDIR=.\Release

INTDIR=.\Release

Begin Custom Macros

OutDir=.\Release

End Custom Macros

!IF “$(RECURSE)” == “0”

ALL : “$(OUTDIR)\ndc-592_27-prod-release.exe”

!ELSE

ALL : “dcapi - Win32 Release” “$(OUTDIR)\ndc-592_27-prod-release.exe”

!ENDIF

!IF “$(RECURSE)” == “1”

CLEAN :“dcapi - Win32 ReleaseCLEAN”

!ELSE

CLEAN :

!ENDIF

-@erase "$(INTDIR)\ndc.obj"

-@erase "$(INTDIR)\vc60.idb"

-@erase "$(OUTDIR)\ndc-592_27-prod-release.exe"

“$(OUTDIR)” :

if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"

CPP=cl.exe

CPP_PROJ=/nologo /Zp1 /ML /W3 /GX /O2 /I “C:\Work\Projects\Sources\DC\592\dcapi” /I “c:\notescpp23\include” /D “W32” /D “WIN32” /D “NDEBUG” /D “_CONSOLE” /D “_MBCS” /Fo"$(INTDIR)\" /Fd"$(INTDIR)\" /FD /cpu “i386” /c

.c{$(INTDIR)}.obj::

$(CPP) @<<

$(CPP_PROJ) $<

<<

.cpp{$(INTDIR)}.obj::

$(CPP) @<<

$(CPP_PROJ) $<

<<

.cxx{$(INTDIR)}.obj::

$(CPP) @<<

$(CPP_PROJ) $<

<<

.c{$(INTDIR)}.sbr::

$(CPP) @<<

$(CPP_PROJ) $<

<<

.cpp{$(INTDIR)}.sbr::

$(CPP) @<<

$(CPP_PROJ) $<

<<

.cxx{$(INTDIR)}.sbr::

$(CPP) @<<

$(CPP_PROJ) $<

<<

RSC=rc.exe

BSC32=bscmake.exe

BSC32_FLAGS=/nologo /o"$(OUTDIR)\ndc.bsc"

BSC32_SBRS= \

LINK32=link.exe

LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /pdb:“$(OUTDIR)\ndc-592_27-prod-release.pdb” /machine:I386 /out:“$(OUTDIR)\ndc-592_27-prod-release.exe”

LINK32_OBJS= \

"$(INTDIR)\ndc.obj" \

"..\..\..\..\..\..\notescpp23\lib\mswin32\notescpp.lib" \

"..\..\..\..\..\..\notescpp23\lib\mswin32\NOTES.LIB" \

"..\dcapi\Release\dcapi.lib"

“$(OUTDIR)\ndc-592_27-prod-release.exe” : “$(OUTDIR)” $(DEF_FILE) $(LINK32_OBJS)

$(LINK32) @<<

$(LINK32_FLAGS) $(LINK32_OBJS)

<<

!ELSEIF “$(CFG)” == “ndc - Win32 Debug”

OUTDIR=.\Debug

INTDIR=.\Debug

Begin Custom Macros

OutDir=.\Debug

End Custom Macros

!IF “$(RECURSE)” == “0”

ALL : “$(OUTDIR)\ndc-592_27-prod-debug.exe”

!ELSE

ALL : “dcapi - Win32 Debug” “$(OUTDIR)\ndc-592_27-prod-debug.exe”

!ENDIF

!IF “$(RECURSE)” == “1”

CLEAN :“dcapi - Win32 DebugCLEAN”

!ELSE

CLEAN :

!ENDIF

-@erase "$(INTDIR)\ndc.obj"

-@erase "$(INTDIR)\vc60.idb"

-@erase "$(INTDIR)\vc60.pdb"

-@erase "$(OUTDIR)\ndc-592_27-prod-debug.exe"

-@erase "$(OUTDIR)\ndc-592_27-prod-debug.ilk"

-@erase "$(OUTDIR)\ndc-592_27-prod-debug.pdb"

“$(OUTDIR)” :

if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"

CPP=cl.exe

CPP_PROJ=/nologo /Zp1 /MLd /W3 /Gm /GX /ZI /Od /Ob1 /I “C:\Work\Projects\Sources\DC\592\dcapi” /I “c:\notescpp23\include” /D “W32” /D “WIN32” /D “_DEBUG” /D “_CONSOLE” /D “_MBCS” /Fo"$(INTDIR)\" /Fd"$(INTDIR)\" /FD /GZ /c

.c{$(INTDIR)}.obj::

$(CPP) @<<

$(CPP_PROJ) $<

<<

.cpp{$(INTDIR)}.obj::

$(CPP) @<<

$(CPP_PROJ) $<

<<

.cxx{$(INTDIR)}.obj::

$(CPP) @<<

$(CPP_PROJ) $<

<<

.c{$(INTDIR)}.sbr::

$(CPP) @<<

$(CPP_PROJ) $<

<<

.cpp{$(INTDIR)}.sbr::

$(CPP) @<<

$(CPP_PROJ) $<

<<

.cxx{$(INTDIR)}.sbr::

$(CPP) @<<

$(CPP_PROJ) $<

<<

RSC=rc.exe

BSC32=bscmake.exe

BSC32_FLAGS=/nologo /o"$(OUTDIR)\ndc.bsc"

BSC32_SBRS= \

LINK32=link.exe

LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:“$(OUTDIR)\ndc-592_27-prod-debug.pdb” /debug /machine:I386 /out:“$(OUTDIR)\ndc-592_27-prod-debug.exe” /pdbtype:sept

LINK32_OBJS= \

"$(INTDIR)\ndc.obj" \

"..\..\..\..\..\..\notescpp23\lib\mswin32\notescpp.lib" \

"..\..\..\..\..\..\notescpp23\lib\mswin32\NOTES.LIB" \

"..\dcapi\Debug\dcapi.lib"

“$(OUTDIR)\ndc-592_27-prod-debug.exe” : “$(OUTDIR)” $(DEF_FILE) $(LINK32_OBJS)

$(LINK32) @<<

$(LINK32_FLAGS) $(LINK32_OBJS)

<<

!ENDIF

!IF “$(NO_EXTERNAL_DEPS)” != “1”

!IF EXISTS(“ndc.dep”)

!INCLUDE “ndc.dep”

!ELSE

!MESSAGE Warning: cannot find “ndc.dep”

!ENDIF

!ENDIF

!IF “$(CFG)” == “ndc - Win32 Release” || “$(CFG)” == “ndc - Win32 Debug”

SOURCE=.\ndc.cpp

“$(INTDIR)\ndc.obj” : $(SOURCE) “$(INTDIR)”

!IF “$(CFG)” == “ndc - Win32 Release”

“dcapi - Win32 Release” :

cd “\Work\Projects\Sources\DC\592\dcapi”

$(MAKE) /$(MAKEFLAGS) /F .\dcapi.mak CFG=“dcapi - Win32 Release”

cd “…\ndc”

“dcapi - Win32 ReleaseCLEAN” :

cd “\Work\Projects\Sources\DC\592\dcapi”

$(MAKE) /$(MAKEFLAGS) /F .\dcapi.mak CFG=“dcapi - Win32 Release” RECURSE=1 CLEAN

cd “…\ndc”

!ELSEIF “$(CFG)” == “ndc - Win32 Debug”

“dcapi - Win32 Debug” :

cd “\Work\Projects\Sources\DC\592\dcapi”

$(MAKE) /$(MAKEFLAGS) /F .\dcapi.mak CFG=“dcapi - Win32 Debug”

cd “…\ndc”

“dcapi - Win32 DebugCLEAN” :

cd “\Work\Projects\Sources\DC\592\dcapi”

$(MAKE) /$(MAKEFLAGS) /F .\dcapi.mak CFG=“dcapi - Win32 Debug” RECURSE=1 CLEAN

cd “…\ndc”

!ENDIF

!ENDIF

Subject: The addinjob works correctly