I can't seem to figure out something getting V8 started up. I have this code:
if (!_V8Initialized)
{
v8::V8::InitializeICU();
v8::V8::InitializeExternalStartupData("x86\\"); // (this loads ok, I checked)
auto platform = v8::platform::CreateDefaultPlatform();
v8::V8::InitializePlatform(platform);
v8::V8::Initialize();
_V8Initialized = true;
}
auto params = Isolate::CreateParams();
params.array_buffer_allocator = ArrayBuffer::Allocator::NewDefaultAllocator();
_Isolate = Isolate::New(params);
But I get this error:
Exception thrown at 0x0000000000000000 in V8.Net.Console.exe:
0xC0000005: Access violation executing location 0x0000000000000000.
v8_libbase.dll!v8::base::OS::Abort() Line 832 C++
v8_libbase.dll!V8_Fatal(const char * file, int line, const char * format, ...) Line 74 C++
v8.dll!v8::internal::SnapshotData::SnapshotData(const v8::internal::Vector snapshot) Line 28 C++
v8.dll!v8::internal::Snapshot::Initialize(v8::internal::Isolate * isolate) Line 43 C++
v8.dll!v8::Isolate::New(const v8::Isolate::CreateParams & params) Line 8237 C++
V8_Net_Proxy_x64.dll!V8EngineProxy::V8EngineProxy(bool enableDebugging, void()() debugMessageDispatcher, int debugPort) Line 89 C++
V8_Net_Proxy_x64.dll!CreateV8EngineProxy(bool enableDebugging, void()() debugMessageDispatcher, int debugPort) Line 19 C++
[Managed to Native Transition]
V8.Net.dll!V8.Net.V8Engine.V8Engine() Line 246 C#
V8.Net.Console.exe!V8.Net.Program.Main(string[] args) Line 31 C#
[Native to Managed Transition]
mscoreei.dll!00007ffdbdd281ad() Unknown
mscoree.dll!00007ffdbddc10ab() Unknown
kernel32.dll!00007ffdd3868364() Unknown
ntdll.dll!00007ffdd5ef70d1() Unknown
It seems to be failing here:
explicit SnapshotData(const Vector<const byte> snapshot)
: SerializedData(const_cast<byte*>(snapshot.begin()), snapshot.length()) {
CHECK(IsSane()); <-- THIS FAILS
}
I followed the source code here (for the most part): https://chromium.googlesource.com/v8/v8/+/branch-heads/4.8/samples/hello-world.cc
... but I'm not sure why it seems I'm getting a null error. I must be missing something...
Nevermind, I always seem to figure things out AFTER posting to SO, lol. It turns out I was loading from the x86 directory and not the x64 directory (which I should have guess given the V8_Net_Proxy_x64.dll! lol).
I was going to delete the question, but I'll leave this here anyhow in case someone else falls into this in the middle of the night half asleep. ;)
Related
I'm new in Embedded systems I am using "atmel Studio7" so I opened ASF wizard T_C driver for xmega128a1 and modified it to set just the timer TCC0 to count 50 ms and throw an overflow flag every 50 ms beside I commented other timers,
I tried to compile but I have one error and I can't correct it the error is: "expected declaration or statement at end of input".
which located in this segment of the code:
void tc_set_ccd_interrupt_callback(volatile void *tc, tc_callback_t callback)
{
#ifdef TCC0
if ((uintptr_t) tc == (uintptr_t) & TCC0)
{
tc_tcc0_ccd_callback = callback;
}
else
#endif
}
anyone have an idea or advise.
Remove the else word. It expects a new statement after it, which you do not have
The complete code is more than 400 line. You can find it here: http://hostcode.sourceforge.net/view/4122 or if you have wxwidgets installed then under WX_WIDGETS_ROOT\samples\wizard\wizard.cpp.
I tried to compile it but get
"error C2065: 'm_bitmap' : undeclared identifier" on line 122.
Then I commented that line and it compiles ok. But when I run it and select one of these menu commands:
File >> Run wizard modal
File >> Run wizard withour sizer
File >>
Run wizard modeless
it goes to MyWizard constructor and crashes on m_page1 = new... line.
MyWizard::MyWizard(wxFrame *frame, bool useSizer)
: wxWizard(frame,wxID_ANY,_T("Absolutely Useless Wizard"),
wxBitmap(wiztest_xpm),wxDefaultPosition,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
{
// a wizard page may be either an object of predefined class
m_page1 = new wxWizardPageSimple(this);<---------------- HERE
and gave this error:
Unhandled exception at 0x004425ec in wizard.exe: 0xC0000005: Access
violation reading location 0xcdcdcdd1.
I checked in debugger and saw that it goes to
void wxWizardPage::Init()
{
m_bitmap = wxNullBitmap;<--- HERE
}
and then a few inner calls later trying to access m_refData->m_count where m_refData contains garbage m_refData = 0xcdcdcdcd {m_count=??? } and then crashed.
void wxObject::UnRef()
{
if ( m_refData )
{
wxASSERT_MSG( m_refData->m_count > 0, _T("invalid ref data count") );<----- HERE
if ( --m_refData->m_count == 0 )
delete m_refData;
m_refData = NULL;
}
}
Here is call stack if it will be useful:
wizard.exe!wxObject::UnRef() Line 346 + 0x6 bytes C++
wizard.exe!wxObject::Ref(const wxObject & clone) Line 335 C++
wizard.exe!wxObject::operator=(const wxObject & other) Line 428 C++
wizard.exe!wxGDIObject::operator=(const wxGDIObject & __that) + 0x13
bytes C++ wizard.exe!wxGDIImage::operator=(const wxGDIImage &
__that) + 0x13 bytes C++ wizard.exe!wxBitmap::operator=(const wxBitmap & __that) + 0x13 bytes C++
wizard.exe!wxWizardPage::Init() Line 126 C++ wizard.exe!wxWizardPage::wxWizardPage() Line 50 + 0x46 bytes C++
wizard.exe!wxWizardPageSimple::wxWizardPageSimple(wxWizard * parent,
wxWizardPage * prev, wxWizardPage * next, const wxBitmap & bitmap,
const char * resource) Line 113 + 0x2e bytes C++
wizard.exe!MyWizard::MyWizard(wxFrame * frame, bool useSizer) Line
376 + 0x31 bytes C++
I am using the SDL2 2.0.3 library with the SDL_image library 2.0.0 in Visual C++ 2010 Express. I am utilizing the SDL_image library to load a variety of PNG and JPEG files from a resources folder. While the library initializes without any errors and loads BMP and JPEG files, it breaks when given a PNG file.
"Unhandled exception at 0x00000000 in appname.exe: 0xC0000005: Access violation."
Inside of my texture manager, (an object that stores and manages textures for the program), is a function to load a texture from a given file name string. Here is the code, including the commented line I used before implementing SDL_image to do the loading. It is within the line bitmapSurface = IMG_Load(... that the exception above is thrown.
/**
* Attempts to load a given image file and reports to the console any failures
*
* #param fileName The exact file name of the resource to be loaded
* #return The SDL_Texture loaded from the given fileName
*/
SDL_Texture* TextureManager::loadTexture(string fileName)
{
//Create our surface in RAM
SDL_Surface *bitmapSurface = NULL;
//bitmapSurface = SDL_LoadBMP(fileName.c_str()); //OLD METHOD; standard SDL, BMP only
bitmapSurface = IMG_Load(fileName.c_str()); //NEW METHOD; SDL_image lib, many formats
//Verify it exists
if (bitmapSurface == NULL)
cout << "Image resource not loaded: " << fileName << " Message: " << IMG_GetError() << endl;
//Create a texture in VRAM from the surface
SDL_Texture *bitmapTexture = NULL;
bitmapTexture = SDL_CreateTextureFromSurface(this->renderer, bitmapSurface);
//Verify it exists
if (bitmapTexture == NULL)
cout << "Failed to create texture: " << fileName << endl;
return bitmapTexture;
}
Call Stack:
00000000()
SDL2_image.dll!6a887a01()
[Frames below may be incorrect and/or missing, no symbols loaded for SDL2_image.dll]
SDL2.dll!6c77da4b()
SDL2_image.dll!6a88792e()
SDL2_image.dll!6a881693()
SDL2_image.dll!6a8817e9()
> appname.exe!TextureManager::loadTexture(std::basic_string<char,std::char_traits<char>,std::allocator<char> > fileName) Line 143 + 0xe bytes C++
00daf5e0()
Here is the constructor for my TextureManager:
/**
* Creates a new TextureManager with the current SDL_Renderer
*
* #param renderer The current renderer instance of the current graphic window
*/
TextureManager::TextureManager(SDL_Renderer* renderer)
{
//Assign our renderer link
this->renderer = renderer;
//Create the vector to hold textures
this->textures = new vector<Texture*>();
//SDL_image initialization
int flags = IMG_INIT_JPG|IMG_INIT_PNG;
int initted = IMG_Init(flags); //Use IMG_Quit(); at closing
if(initted&flags != flags)
{
//Handle error
printf("IMG_Init: Failed to init required jpg and png support!\n");
printf("IMG_Init: %s\n", IMG_GetError());
}
else
{
cout << "SDL_Image initialized for JPEG and PNG support" << endl;
}
}
For your information, I am using Windows 10 x64, which is up to date. Graphics drivers for dual NVidia GTX 550ti are up to date as well.
All DLL files (including the pnglib dll) are in the debug folder and do load. If I remove the DLL file from the program, the image fails to load and provides the message as coded above for NULL surfaces. No exceptions occur.
Question summary:
Why is this exception thrown, why is it only thrown for PNG files, and how can I trace it when the call stack's details end at my call that appears to work properly? Am I doing something wrong, or is there a configuration step I may have missed?
EDIT: Thanks to #Nandu I have recompiled the DLL SDL_image, and got a better call stack output here:
00000000()
> SDL2_image.dll!IMG_LoadPNG_RW(SDL_RWops * src) Line 375 + 0x11 bytes C
SDL2_image.dll!IMG_LoadTyped_RW(SDL_RWops * src, int freesrc, const char * type) Line 193 + 0x12 bytes C
SDL2_image.dll!IMG_Load(const char * file) Line 134 + 0xf bytes C
appname.exe!TextureManager::loadTexture(std::basic_string<char,std::char_traits<char>,std::allocator<char> > fileName) Line 143 + 0xe bytes C++
appname.exe!TextureManager::loadFromDirectory(std::basic_string<char,std::char_traits<char>,std::allocator<char> > relPath) Line 117 + 0x73 bytes C++
appname.exe!SDL_main(int argc, char * * argv) Line 31 C++
appname.exe!main(int argc, char * * argv) Line 140 + 0xd bytes C
appname.exe!__tmainCRTStartup() Line 555 + 0x19 bytes C
appname.exe!mainCRTStartup() Line 371 C
kernel32.dll!77963744()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!77c3a064()
ntdll.dll!77c3a02f()
This suggests the problem is occurring on line 374 of IMG_png.c:
/* Create the PNG loading context structure */
png_ptr = lib.png_create_read_struct(PNG_LIBPNG_VER_STRING,
NULL,NULL,NULL);
VS reports that lib is NULL at this time, which would explain the error! The question becomes, why is it NULL? It seems this code should be doing a check for that, but nonetheless, nobody else seems to having this problem on the almighty internet.
Thank you all very much for you help, but the problem, as usual, was rather obvious!
As noted here by #Gigi: SDL_Image IMG_Load fails on png with: "Failed loading libpng16-16.dll:"
I suggest you try including all the rest - there may be a dependency that you and I are not aware of. In fact I just checked, and libpng requires zlib: libpng.org/pub/png/libpng.html
I'm not sure why my original search or suggestions didn't bring that post up.
I originally excluded the DLLs for other file formats I wasn't using (or initializing in my code), but once I included the zlib DLL, bingo. PNGs load exactly as expected.
I'm trying to build my game on release mode using CMake. I disabled DEBUG_MODE and successfully built the project but when I run it I get an error I don't get in debug mode.
Here's the call stack.
KernelBase.dll!763d2f71() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]
[External Code]
> SortingGame.exe!BackgroundBuilder::configureTimeLabel(const cocos2d::Vec2 timeContainerEndPos) Line 236 C++
SortingGame.exe!BackgroundBuilder::configureTimeContainerSprite() Line 226 C++
SortingGame.exe!GameScene::configureTimeContainerSprite() Line 352 C++
SortingGame.exe!GameScene::configureScene() Line 210 C++
SortingGame.exe!GameScene::init() Line 130 C++
SortingGame.exe!GameScene::create() Line 25 C++
SortingGame.exe!LoadingScreen::onKeyPressed(cocos2d::EventKeyboard::KeyCode keyCode, cocos2d::Event * event) Line 168 C++
[External Code]
SortingGame.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 24 C++
[External Code]
BackgroundBuilder::configureTimeContainerSprite() function gets called only once. If I call BackgroundBuilder::configureTimeContainerSprite() in BackgroundBuilder::BackgroundBuilder() the error doesn't occur in BackgroundBuilder::configureTimeContainerSprite() but in main.cpp file's return Application::getInstance()->run(); line. The error is the same here too.
I get the same error when I build the project with Visual Studio 2013.
I figured out the problem. It appears that there's a problem with the way I pre-load assets into my game. In the TitleScreen::init() I use this function to load assets.
GameManager::getInstance()->getResourceManager()->loadTextures("GameScene", callback);
And here's the implementation for the CocosResourceManager::loadTextures()
void CocosResourceManager::loadTextures(const std::string &sceneName, const std::function<void(std::string sceneName, int loadedAssetCount, int totalAssetCount)> &callback)
{
std::map<std::string, std::string> assets = parseAssetsArray(sceneName);
int totalAsset = assets.size(), loadedAsset = 0;
for (auto value : assets) {
TextureCache::getInstance()->addImage(value.second);
loadedAsset++;
callback(sceneName, loadedAsset, totalAsset);
}
}
When I don't pe-load the assets with that function, there's no crash in release mode. When I pre-load them, I have it with the stack trace I previously posted above. This happens with both TextureCache::getInstance()->addImageAsync(); and TextureCache::getInstance()->addImage();
Am I pre-loading the wrong way? Can anybody explain why this is happening?
I am going throught Multiple Selection in a File Dialog article of code project,
this code works fine for visual studio 2005 but when i run it on visual studio 2010 it gives me an debug assertion as follow,
Unhandled exception at 0x76f515de in MultiSelect.exe: 0xC0000005:
Access violation reading location 0x00000020.
At the following point,
int ret = CFileDialog::DoModal(); //**Point where assersion occures**
Whole function is like follow(Note:-CFECFileDialog inherited from CFileDialog)
int CFECFileDialog::DoModal()
{
if (Files)
{
delete[] Files;
Files = NULL;
delete[] Folder;
Folder = NULL;
}
int ret = CFileDialog::DoModal(); //**Point where assersion occures**
if (ret == IDCANCEL)
{
DWORD err = CommDlgExtendedError();
if (err == FNERR_BUFFERTOOSMALL/*0x3003*/ && Files)
ret = IDOK;
}
return ret;
}
I also ask question for author of that article but he is not replying.
I downloaded the project from CodeProject and got a crash at CFECFileDialog::OnFileNameChange. Using the VS2010 debugger and the "Go to disassembly" option, i saw that the crash was caused by GetParent returning NULL.
As I have no idea why the CommDlg_OpenSave_* macros were called with a "parent" handle, I just tried calling them with the "this" handle (m_hWnd). Works for me.
Try replacing each instance of "GetParent()->m_hWnd" by "m_hWnd" in CFECFileDialog::OnFileNameChange
EDIT: precision, I did not got the crash you had in DoModal