Click here to Skip to main content

C / C++ / MFC

    RSS: RSS Feed

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page  Show 
  Refresh
GeneralInteraction betwwen CDialog and CDocument PinmemberPuah22:29 3 Aug '04  
GeneralRe: Interaction betwwen CDialog and CDocument PinsupporterMichael P Butler0:38 4 Aug '04  
QuestionWhat menu item was selected? Pinmembergokings22:14 3 Aug '04  
AnswerRe: What menu item was selected? Pinmembercmk1:28 4 Aug '04  
AnswerRe: What menu item was selected? PinmemberV.2:07 4 Aug '04  
AnswerRe: What menu item was selected? Pinmembercmk10:53 4 Aug '04  
GeneralRe: What menu item was selected? Pinmembergokings23:12 5 Aug '04  
GeneralUrgent:malloc gives access violation for a C dll Pinmemberrana7422:07 3 Aug '04  
I have a C application from a third party vendor,which I have to convert into a DLL.
For this purpose I have exported a function from the app as
__declspec(dllexport) char* maindllentrypoint(int argc, char* argv[]);
And i build the app has a DLL.
 
But I get 'access violation' error for malloc.
char* maindllentrypoint(int argc, char* argv[])
{
char* strData;
strData=malloc(24);
return strData;
}
So I think the C run-tie is not getting initialised properly.
So I put an entry point to the DLL(though I am not sure whether it is required)
BOOL WINAPI DllMain(
HINSTANCE hinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpReserved ) // reserved
{
// Perform actions based on the reason for calling.
switch( fdwReason )
{
case DLL_PROCESS_ATTACH:
// Initialize once for each new process.
// Return FALSE to fail DLL load.
break;
 
case DLL_THREAD_ATTACH:
// Do thread-specific initialization.
break;
 
case DLL_THREAD_DETACH:
// Do thread-specific cleanup.
break;
 
case DLL_PROCESS_DETACH:
// Perform any necessary cleanup.
break;
}
return TRUE; // Successful DLL_PROCESS_ATTACH.
}
But I still get the error.My C run-time is linked statically with /MT option.
How do i prevent this crash?

QuestionHow to use MFC structure CMemory State in a Non-MFC application PinsussPrathima Prabhakar Rao21:51 3 Aug '04  
AnswerRe: How to use MFC structure CMemory State in a Non-MFC application PinmemberAnthony_Yio2:19 4 Aug '04  
QuestionHow to draw figures in MSFlexgrid Cell Pinmemberkjadhav21:18 3 Aug '04  
Questiondebug mode fails to run?? Pinmemberxxhimanshu20:47 3 Aug '04  
AnswerRe: debug mode fails to run?? Pinmember Mil1021:23 3 Aug '04  
Generalsystem log-off/shut-down response from my application PinsussAnonymous20:20 3 Aug '04  
GeneralPlease help me with the Arithmetic Coding base on Khalid Sayood Pinmemberhuffmancoding19:48 3 Aug '04  
Generalstarting an application at startup, before logging in PinsussAnonymous19:22 3 Aug '04  
GeneralRe: starting an application at startup, before logging in PinmemberAntony M Kancidrowski2:09 4 Aug '04  
GeneralRe: starting an application at startup, before logging in PinsussAnonymous2:27 4 Aug '04  
GeneralRe: starting an application at startup, before logging in PinmemberAntony M Kancidrowski3:49 4 Aug '04  
GeneralRe: starting an application at startup, before logging in PinsussAnonymous2:24 4 Aug '04  
QuestionSend Messages? PinmemberZero_One_ADO19:10 3 Aug '04  
Answerno Pinmemberbikram singh19:44 3 Aug '04  
GeneralVisual C++ WinSNMP API: PinsussAlan Lewis17:00 3 Aug '04  
GeneralOptimization PinmemberSibilant15:54 3 Aug '04  
GeneralVisual C++ static member initialization PinmemberIndrawati15:25 3 Aug '04  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.5.120210.1 | Last Updated 14 Feb 2012
Copyright © CodeProject, 1999-2012
All Rights Reserved. Terms of Use
Layout: fixed | fluid