-
July 5th, 2011, 09:17 AM
#1
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?
-
July 5th, 2011, 09:40 AM
#2
Re: Void pointer
Originally Posted by superkemo
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:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
July 5th, 2011, 09:43 AM
#3
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?
-
July 5th, 2011, 10:17 AM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|