0

I have a error. The debugger says 0cx000000 or something like that access violation, which after reading online I found has to do with memory access violation or pointing t0 null memory location. Similar, but not same codes, examples, seem to be working. I do not understand the problem with this one. Or I do not understand how to solve this one.

Precise Error:

Unhandled exception at 0x00000000 in myfile.exe: 0xC0000005: Access violation reading location 0x00000000 on.

Main File:

MSG Msg;
HWND hWnd;

static void doSth(FIX32 propert[])
{
UINT wdev;
myFunction(WTI_DEFCONTEXT, CTX_DEVICE, &wdev);
.
.
.
}

WndProc()
{
switch(Msg){

case WM_CREATE:
    doSth(propert);
    return 0;
}

WINAPI WinMain(...)
{
hWnd=Create...

return Msg.wParam;
}

Source Code:

Bool LoadD(void)
{
libr=LoadLibrary(...);
GetProcessAddress(libr,myFunction);
return TRUE;
}

void UnloadD(void)
{
FreeLibrary(libr);
myFunc=NULL;
}

I had linking problem. Solved it. But this pointer problem is giving me trouble. The debugger points to the two lines in the code.

myFunction(WTI_DEFCONTEXT, CTX_DEVICE, &wdev);
doSth(propert);

I know this is vague, with this little information. Specially there are a lot of header files involved too. But, is the problem/solution apparent from this code? The problem is null reference(??). What is solution?

4

2 回答 2

1

您应该提供“myFunction”的定义。我希望它能让我们更好地理解问题。检查您是否传递了 wdev 的地址,但值未初始化,并检查您是否接收到正确的指针。

于 2013-07-01T10:18:15.050 回答
0

我在加载库时遇到了一些问题。只是探索了一点,实际上是固定的。引用 hmjd:

Does LoadLibrary() succeed? Where is the result of GetProcAddress() stored and does it succeed?

谢谢

于 2013-07-01T12:22:10.317 回答