BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DLL with string resource

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
--== Alain ==--
Guest





PostPosted: Fri Sep 15, 2006 5:31 pm    Post subject: DLL with string resource Reply with quote



Hi,

I have old DLLs which contain stringtable as resource.
if i use them via my DLL class wrapper, everything works well.

Now i've created a new DLL via BDS2006, *.h and *.cpp file are similar
to old DLL files. when i compile the new DLL everything is ok.

I have problem when i use it.
BDS2006 returns me the following error :
Project TESTLNG.exe raised exception class EAccessViolation with message
'Access violation at address 00000000. Read of address 00000000'

the problem seems to be located to the GetResStr function.

here is my *.h file of my class wrapper:
//---------------------------------------------------------------------------
#include <System.hpp>

#ifndef CARDLLWrapperH
#define CARDLLWrapperH

//------------------------------------------------------------------------------
static HINSTANCE m_hlibLoc;
String FAR __pascal (*locGetString)(long);

class CARDLLWrapper
{
private:
public:
HINSTANCE __fastcall InitializeLoc(AnsiString DLLName);
void __fastcall TerminateLoc(HINSTANCE hlibLoc);
String __fastcall GetResStr(long Index);
};
//---------------------------------------------------------------------------
#endif



here is my *.cpp file :
//---------------------------------------------------------------------------
#pragma hdrstop
#include "CARDLLWrapper.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
//------------------------------------------------------------------------------
HINSTANCE __fastcall CARDLLWrapper::InitializeLoc(AnsiString DLLName)
{
m_hlibLoc=LoadLibrary((DLLName + String(".dll")).c_str());
if (m_hlibLoc != NULL)
{
(FARPROC) locGetString=GetProcAddress(m_hlibLoc,"GETSTRING");
return m_hlibLoc;
}
else
{
return 0;
}
}
//------------------------------------------------------------------------------
String __fastcall CARDLLWrapper::GetResStr(long Index)
{
static String strRes;
strRes=locGetString(Index);
return strRes;
}

in my DLL locGetString is declared as following :

extern "C" String __export GetString(int Index);

String GetString(int Index)
{
String res=AnsiString::LoadStr((int)Index);
return res;
}
Back to top
Danzer
Guest





PostPosted: Fri Sep 15, 2006 8:33 pm    Post subject: Re: DLL with string resource Reply with quote



--== Alain ==-- wrote:
Quote:
Hi,

I have old DLLs which contain stringtable as resource.
if i use them via my DLL class wrapper, everything works well.

Now i've created a new DLL via BDS2006, *.h and *.cpp file are similar
to old DLL files. when i compile the new DLL everything is ok.

I have problem when i use it.
BDS2006 returns me the following error :
Project TESTLNG.exe raised exception class EAccessViolation with message
'Access violation at address 00000000. Read of address 00000000'


Have you tried madExcept to help you find where the error occurs?
MadExcept is free, if you use it as specified in the EULA.

Danzer
Back to top
Bob Gonder
Guest





PostPosted: Sat Sep 16, 2006 1:40 am    Post subject: Re: DLL with string resource Reply with quote



--== Alain ==-- wrote:

See my answer in the Language group, where you also posted this
question.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.