File I/O inside a C++ dll?

I'm trying to build a C++ dll that is used by a Visual Basic GUI; it's a micromouse simulator. I've had success in getting the two to talk to one another, but now I'm trying to give the dll file I/O capability. I want it to read in a text maze and store it in a two dimensional array and change the array (so the user can make custom mazes in the gui) as prompted by the user. The code works fine in a normal C++ program; it reads in the file just fine and displays it. When I try to change the wall in the VB gui, a window pops up with the following error: "PInvoke restriction: cannot return variants." How can I fix this? The inputs for the function are the indices of the wall location within the array. I'm not trying to change the .txt file itself, just the array that's been filled inside the dll.

/*testDLL.cpp*/

#include "testDLL.h"
#include <stdio.h>

FILE *maze;

char mazearray[12][12];

void _stdcall wallfunction(int x, int y){

maze = fopen ("5x5mazedefault.txt", "r");
fread (mazearray, sizeof(mazearray), 1, maze);
fclose(maze);
if (mazearray[x][y] == 'X'){
mazearray[x][y] = ' ';
}
else if (mazearray[x][y] == ' '){
mazearray[x][y] = 'X';
}
}


exports.def

LIBRARY testDLL

EXPORTS
wallfunction @1
Topic archived. No new replies allowed.