Re: Problem with DLL / Lib
It doesn't do any good posting those three lines. They are all valid C++ syntax.
No one knows what enumResultsClear() does. You are telling us second-hand what it does, but how can we know this for sure? The errors are clear in that the function caused an access violation.
Maybe the structure needs to be initialized somehow by you before you send it to the enumResultsClear()? I don't know, you should tell us *exactly* what the documentation says what the function is supposed to do, and if any prerequisites are required before calling it.
It could also be a bug in the library itself. Again, three lines of code with no context isn't going to help solve the problem.
Regards,
Paul McKenzie
Re: Problem with DLL / Lib
Ok, I didn't think it was a problem with the code, I had assumed that it was a problem with my project settings.
There is no documentation for the library, but I do have the source code for the function. Here it is:
Code:
void enumResultClear(enum_result_t *result)
{
memset(result, 0, sizeof(enum_result_t));
}
the structure 'result' is as follows:
Code:
typedef struct {
enum_game_t game;
enum_sample_t sampleType;
unsigned int nsamples;
unsigned int nplayers;
unsigned int nwinhi[ENUM_MAXPLAYERS];
unsigned int ntiehi[ENUM_MAXPLAYERS];
unsigned int nlosehi[ENUM_MAXPLAYERS];
unsigned int nwinlo[ENUM_MAXPLAYERS];
unsigned int ntielo[ENUM_MAXPLAYERS];
unsigned int nloselo[ENUM_MAXPLAYERS];
unsigned int nscoop[ENUM_MAXPLAYERS];
unsigned int nsharehi[ENUM_MAXPLAYERS][ENUM_MAXPLAYERS+1];
unsigned int nsharelo[ENUM_MAXPLAYERS][ENUM_MAXPLAYERS+1];
unsigned int nshare[ENUM_MAXPLAYERS][ENUM_MAXPLAYERS+1][ENUM_MAXPLAYERS+1];
double ev[ENUM_MAXPLAYERS];
enum_ordering_t *ordering;
} enum_result_t;
Re: Problem with DLL / Lib
Are you sure the DLL and your source code are built using the same settings, in terms of structure alignment?
Regards,
Paul McKenzie
Re: Problem with DLL / Lib
No I'm not. I'm new to using DLL's.
I can tell you I build the DLL / Lib using the nmake tool and a makefile.dos
Here's the copy of the makefile if its any use :
Code:
# Generated automatically from Makefile.in by configure.
LIBPOKER = ../lib/libpoker.lib
CC = cl
CFLAGS = -O1 -nologo -DNDEBUG -MD -DMSDOS
RANLIB = rem
AR = ar
RM = del
CC_OBJ = $(CC) $(CFLAGS) -I../include -c -Fo$@ $**
CC_EXE = $(CC) $(CFLAGS) -I../include -Fe$@ $**
RUN_IT = $**
LIB_CMD = LIB /OUT:$@ $**
PROGRAMS = five_card_hands.exe seven_card_hands.exe fish.exe eval.exe \
hcmp2.exe hcmpn.exe usedecks.exe pokenum.exe
all : $(PROGRAMS)
five_card_hands.exe: five_card_hands.obj $(LIBPOKER)
$(CC_EXE)
seven_card_hands.exe: seven_card_hands.obj $(LIBPOKER)
$(CC_EXE)
fish.exe: fish.obj $(LIBPOKER)
$(CC_EXE)
eval.exe: eval.obj $(LIBPOKER)
$(CC_EXE)
hcmp2.exe: hcmp2.obj $(LIBPOKER)
$(CC_EXE)
hcmpn.exe: hcmpn.obj $(LIBPOKER)
$(CC_EXE)
usedecks.exe: usedecks.obj $(LIBPOKER)
$(CC_EXE)
pokenum.exe: pokenum.obj $(LIBPOKER)
$(CC_EXE)
clean:
$(RM) core *.obj $(PROGRAMS)
.c.obj:
$(CC_OBJ)
Makefile: Makefile.in
Re: Problem with DLL / Lib
Quote:
Originally Posted by BigWinston
No I'm not. I'm new to using DLL's.
Basically, what is sizeof(enum_result_t) in your app, and what is sizeof(enum_result_t) in your DLL? Are they the same?
You will need to add this to your code to determine what they are.
Regards,
Paul McKenzie