ObjectARX
cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

Access violation reading location 0x00000000 in 32-bit application

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
chockalingam
6188 Views, 9 Replies

Access violation reading location 0x00000000 in 32-bit application

Hi,

I am using below code in my application.

This works fine in 64-bit application, but when i am trying to use in 32-bit application i am receiving "Unhandled exception at 0x00000000 in acad.exe: 0xC0000005: Access violation reading location 0x00000000.", in 

acdbOpenObject(pBlockDef, objBlock, AcDb::kForRead);

Can anyone help me in solving this issue.

 

*****************************************************Code Used*************************************************************

 

BOOL insertBlock(CString csBlockName, CString csLayerName, ads_point ptIns, double dScale, double dHeight, double dRotation, CString csTextStyle, AcDbObjectId& objInsert, BOOL bIsMSpace)

{

AcDbObjectId objBlock;
if (ensureSymbolAvailability(csBlockName, objBlock) == FALSE) { return FALSE; }

// Convert the insertion base point
AcGePoint3d geBasePoint(ptIns[X], ptIns[Y], ptIns[Z]);

// Create a new block reference object
AcDbBlockReference *pInsert = new AcDbBlockReference;
pInsert->setBlockTableRecord(objBlock);
pInsert->setPosition(geBasePoint);
pInsert->setNormal(AcGeVector3d(0, 0, 1));
pInsert->setRotation(dRotation);
pInsert->setScaleFactors(AcGeScale3d(dScale, dScale, dScale));
pInsert->setLayer(csLayerName);

// Add this entity to the current drawing
// NOTE: This will create the block reference without any attributes in it
objInsert = appendEntityToDatabase(pInsert, bIsMSpace);

// Open the block definition for read
AcDbBlockTableRecord *pBlockDef; acdbOpenObject(pBlockDef, objBlock, AcDb::kForRead);

 

AcDbBlockTableRecordIterator *pIterator; pBlockDef->newIterator(pIterator);

AcDbEntity *pEnt;
AcDbAttributeDefinition *pAttdef;

// For each entity in the block
for (pIterator->start(); !pIterator->done(); pIterator->step())
{

}

}

*********************************************************************************************************************************

 

Thanks,

Chockalingam

9 REPLIES 9
Message 2 of 10
chockalingam
in reply to: chockalingam

Hi,

Can any one help me in solving this issue

Message 3 of 10
loic.jourdan
in reply to: chockalingam

Maybe a guess.. (?) do you use AcDbObjectId::setFromOldId() somewhere?

----
20-20 CAD / 20-20 Technologies
Message 4 of 10
chockalingam
in reply to: chockalingam

Hi loic.jourdan,


Thanks for your reply

But i am not using setFromOldId() in my code



Message 5 of 10
loic.jourdan
in reply to: chockalingam

does your object id looks well formed? I mean can you call objBlock.database(), objBlock.objectClass().... I've seen some cases where the object id was corrupted, In my case, it was due to a call of setFromOldId but it may occurs in other cases (?)

 

Is ensureSymbolAvailability doing something special?

 

Sorry if it doesn' t help

 

loic

----
20-20 CAD / 20-20 Technologies
Message 6 of 10
chockalingam
in reply to: chockalingam

Hi,

After checking the error status for every line of the code, i found another issue

 

pInsert->setBlockTableRecord(objBlock);

 

results "enotimplemented" error. 

Can anyone help me in solving this issue.

 

 

 

 

Thanks,

Chockalingam

 

 

Message 7 of 10
loic.jourdan
in reply to: chockalingam

It just looks to me that your objBlock object id is not valid, have you inspected your ensureSymbolAvailability function?

 

----
20-20 CAD / 20-20 Technologies
Message 8 of 10
Matti72
in reply to: chockalingam

Are you sure, that you are linking the right librarys for the Acad funcitonalitys?

 

There is a set of librarys for the 64 bit Version and another set for the 32 bit version... seems to me, that you link your 32bit Version also with the 64bit librarys.

 

So it crashes on a 32bit system but works fine with a 64bit system.

Message 9 of 10
loic.jourdan
in reply to: Matti72

Hi,

in my mind, this is not a library issue, the arx app wouldn't event build (if project target is x64 linked to 32 bits libraries: link error) nor load (if project target is x64 linked to 64 bits libraries: a 64b app cannot be loaded in acad 32) 

 

----
20-20 CAD / 20-20 Technologies
Message 10 of 10
chockalingam
in reply to: chockalingam

Hi,

Thanks for all your efforts, finally i found the solution.

 

I just changed 

AcDbBlockReference *pInsert = new AcDbBlockReference;

to

AcDbBlockReference *pInsert = new AcDbBlockReference(geBasePoint,objBlock);

 

this solves the error.

 

I don't know whats the reason for the error, but i get the error resolved and my code works fine now.

 

 Ioic.jourdan and matti72, thanks for your efforts to solve my error

 

 

Thanks,

Chockalingam.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

ā€Boost