我写了一个dll(比如aa.dll),每当主程序project1.exe执行到LoadLibrary("aa.dll");的时候,弹出错误:Project project1.exe raised exeception class EFilterError with message 'A class named TdxTreeListColumn already exists'.
点击‘确定‘按钮后, 又出现 Project project1.exe raised exeception class EStackOverflow with message 'Stack overflow'.请问这是怎么回事?先谢谢大家。

解决方案 »

  1.   

    if( NULL == DLLInst )
            DLLInst = LoadLibrary("topodll.dll"); //就是在这行上出错
        if (DLLInst)
        {
            CreateFromFunct = (void (__stdcall*)()) GetProcAddress(DLLInst, "UpdateTopo_XLT");
            if (CreateFromFunct)
                CreateFromFunct();
            else
                ShowMessage("Could not obtain function pointer");
        }
        else ShowMessage("Could not load DLL.dll");
    下面是要调用的函数
    extern "C" void __declspec(dllexport) __stdcall ShowTopo(AnsiString objectid,TForm* parentform,TTreeView* ObjectTreeView,TList* vMenuList)
    {
        for(int i=(parentform->MDIChildCount-1);i>=0 ;i--)
        {
          if(parentform->MDIChildren[i]->Name.Pos("frmTopoLayer")>0)
          {
             if(((TfrmTopoLayer*)parentform->MDIChildren[i])->root_maplayer_id==AnsiString(objectid))
             {
                 parentform->MDIChildren[i]->BringToFront();
                 return;
             }
          }
        }    if(objectid != NULL)
        {
            TTreeView* view;
            view = (TTreeView*)ObjectTreeView;
            ///////如果把下面几行注释掉旧不会有问题。
            TfrmTopoLayer *frmTopoLayer = new TfrmTopoLayer(NULL);
            frmTopoLayer->setMaplayerParam("90", objectid,vMenuList,view->Selected->Text);
            frmTopoLayer->Show();
            if(frmTopoLayer!= NULL)
            {
                delete frmTopoLayer;
                frmTopoLayer = NULL;
            }
            ///////注释范围end
        }
    }