Void pointer
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Void pointer

  1. #1
    Join Date
    Mar 2010
    Posts
    47

    Void pointer

    In the code for a C library I am using the author has defined some void pointers eg. here webCoreC is void*

    Code:

    WebCoreC webCore = awe_WebCore_new(); // OK

    WebViewC m_webView = awe_WebCore_createWebView(webCore, 200, 200);
    WebViewListenerC listener;
    memset(&listener, 0, sizeof(WebViewListenerC));
    listener.onBeginLoading = onBeginLoading;
    listener.onDOMReady = onDOMReady;
    listener.onCallback = onCallback;
    listener.onRequestDownload = onRequestDownload;

    awe_WebCore_setBaseDirectory(webCore, "C:\\Test\\");
    awe_WebView_createObject(m_webView, L"Client");

    I want to be able to return webCore in a get function so other classes can access it but when I make it a member or global I get a crash.

    Code:

    WebCoreC webCore; // global

    Error
    GUIScene::Initialize(
    std::vector<Properties::Property> Properties
    )
    {
    webCore = awe_WebCore_new(); // Causes crash later

    WebViewC m_webView = awe_WebCore_createWebView(webCore, 200, 200);
    WebViewListenerC listener;
    memset(&listener, 0, sizeof(WebViewListenerC));
    listener.onBeginLoading = onBeginLoading;
    listener.onDOMReady = onDOMReady;
    listener.onCallback = onCallback;
    listener.onRequestDownload = onRequestDownload;

    awe_WebCore_setBaseDirectory(webCore, "C:\\Test\\");
    awe_WebView_createObject(m_webView, L"Client")

    Can you tell me why this happens? Is it some problem with the library itself or am I doing something wrong?

  2. #2
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,526

    Re: Void pointer

    Quote Originally Posted by superkemo View Post
    Code:
    webCore = awe_WebCore_new(); // Causes crash later
    Can you tell me why this happens?
    First, are you sure it happens "later" and not before you call that function?
    Could you have another webCore defined that hides your global definition?
    Could you have deleted this webCore before that crash?
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinViewer - an integrated GDI objects viewer for Visual C++ Debugger, and more...

  3. #3
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Fairfax, VA
    Posts
    10,888

    Re: Void pointer

    Could you link to the documentation for this library so that those of us unfamiliar with it have at least some hope of being helpful?

  4. #4
    Join Date
    Mar 2010
    Posts
    47

    Re: Void pointer

    Looks like the crash was being caused by something unrelated. Sorry about that, if I knew how to delete the thread I would but I can't see any delete options on the edit page.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center