Jump to content
Xtreme .Net Talk

In a DLL why should a wstring pointer not work?


Recommended Posts

Guest ananda vardhana
Posted

Hello,

 

MyFunc() does not build and MyFunc1() builds and works.

 

I get the following error for MyFunc():

 

error LNK2019: unresolved external symbol _invalid_parameter referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEAX_K@Z)

error LNK2019: unresolved external symbol _CrtDbgReport referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEAX_K@Z)

 

 

This failure happens only in the context of a DLL in a regular function call this works fine. Why is that? I guess in a DLL we have to do something more to tell the function about the space available.

 

One more related question. How can one connect the these Linker error back to the source code. The error does not publish the line number nor the names of variable that is causing the error. Is there a way to force VS2019 to give out more helpful error message.

 

Please advice

 

thanks

 

ananda

 

_declspec(dllexport)

BOOLEAN

MyFunc(

wstring* PErrMsg

)

{

*PErrMsg = L"abcd";

return TRUE;

}

 

_declspec(dllexport)

BOOLEAN

MyFunc1(

char * PErrMsg1

)

{

sprintf_s(PerrMsg1, 10, "xyz");

return TRUE;

}

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...