
Hello, this is to anybody who works with smilib on Windows.
I am trying to use libsmi-0.4.0 on WindowsNT. I am using VC6.0. The lib and my testing code compile with no problem but at run-time I see this assertion:
----------------------------------------------------- Debug Assertion Failed!
Pogram: D:\projects\libsmitest\Debug\libsmitest.exe File: dbgheap.c Line: 1084
Expression: pHead->nBlockUse == nBlockUse -----------------------------------------------------
The code in question is: smiInit(NULL); smiSetPath("d:\projects\smi\mibs\ietf"); smiLoadModule("SNMPv2-SMI"); smiLoadModule("SNMPv2-TC"); smiLoadModule("SNMPv2-CONF"); smiLoadModule("SNMPv2-MIB");
The assertion gets fired on the last call to LoadModule. If I leave that call out, the program runs cleanly but doesn't do anything useful, of course. I saw a problem like this on this list in June but the answer was simply to call smiInit first which is the case with my code. Running the debugger shows that the error occurs when smiparse() gets called but this is what the call stack contains:
_free_dbg(void * 0x00309630, int 2) line 1084 + 43 bytes __crtsetenv(const char * 0x0030aa90, const int 1) line 174 + 17 bytes LIBSMITEST! putenv + 54 bytes timegm(tm * 0x00000002) line 165 + 10 bytes mainCRTStartup() line 206 + 25 bytes KERNEL32! 77f1b9ea()
Unfortunately I cannot trace into smiparse() because the debugger does not seem to be able to handle the flex/bison-code or it is simply not there.
The whole thing does not happen on Linux (gcc)!
Any help is appreciated!
Henning

Problem solved!
Since I got libsmi compiled in the IDE (Workbench, ... whatever) my testing code doesn't crash any more. I used a "static link library" project file and the following Defines (tx to Arthur):
WIN32,_DEBUG,_CONSOLE,_MBCS,__STDC__,_MT
I also added the following lines to win/win.h to get rid of all errors and warnings:
#include <stdio.h> #define strdup( s ) _strdup( s ) #define putenv( e ) _putenv( e ) #define access( f,m ) _access( f,m ) #define isatty( h ) _isatty( h )
util.c doesn't include win.h, so I added:
#ifdef HAVE_WIN_H #include "win.h" #endif
This is libsmi-0.4.0 on VC++ 6.0
Henning
Teilnehmer (1)
-
Henning Eggers