2

For some time I have been trying to find a solution for the below problem, but with no success:

  1. I have a "c" dll, where the following structure is defined:

file: myDll.h

#ifdef EXPORTS
#define EXPORT __declspec(dllexport)
#else
#define EXPORT __declspec(dllimport)
#endif

EXPORT struct my_test 
{
 unsigned char  dum0000001[2144];                                              
 int            test1[32];                                                                                                  
 unsigned char  test2[32];           
} test;

In my c++ executable i include the myDll.h file and try to modify test1 and test2:

extern "C" 
{
#include "myDll.h"
}

int main(int argc, char** argv)
{
 test.test1[0] = 0; 
 test.test2[0] = 0;
}

the program passes correctly through:

test.test1[0] = 0; 

but once

test.test2[0] = 0;

is reached, i get the following exception:

First-chance exception at 0x00401028 in test.exe: 0xC0000005: Access violation writing location 0x1000c030.

I really do not have an idea what's wrong. Perhaps somebody could give me an advice?

Thank You in advance.

Vincent Savard
  • 34,979
  • 10
  • 68
  • 73
test_c
  • 21
  • 1

0 Answers0