compiling a DLL

L

Luigi Puleio

Hello everyone...

I am trying to make a simple and little DLL wrapper to MSXML4 libraries to
make it being called from an another-platform's application.

While creating the msxml4.tlh file, I figured this inside:

virtual HRESULT __stdcall get_output (
/*[out,retval]*/ VARIANT * varDestination ) = 0;

and I have in my dll source code (it is only one function with the entry
point BOOL __stdcall DllMain(HINSTANCE hModule, DWORD ul_reason_for_call,
LPVOID lpReserved) ) this thing:

LPCSTR szElementContent;
LPCSTR cvoutput;

wcscpy(cvoutput, pSAXWriter->get_output);
wcscpy((wchar_t *)m_szElementContent, cvoutput);

it says I can't convert from const char * (I guess) of get_output method to
LPCSTR or even also wchar_t * as you see:

Acu2XML.cpp(82) : error C2664: 'wcscpy' : cannot convert parameter 1 from
'LPCSTR' to 'wchar_t *'
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast

Do you have any idea?

Thanks a lot,
ciao!
Luigi
 
L

Luigi Puleio

Hello,
http://www.codeprojetc.com/string/CPPStringGuide2.asp

It should help with conversion between different kinds of strings.

In fact I have a function call declaration like:

long Acu2XML(LPCSTR szXMLFile, LPCSTR szFilterValue, LPCSTR szAttributeName,
LPCSTR szAttributeValue, LPCSTR szDelimiter, LPCSTR m_szElementContent)

where they are all LPCSTR variabiles where the last one (m_szElementContent)
is the returning one...

Here, since the MXXMLWriter's function get_output works with VARIANT
variabiles I try to initialize
a variant variable:

::VariantInit(&cvoutput);

then I work with this one getting the output from MXXMLWriter then as
standard dotnet specifications for variant variables,
I can use cvoutput.bstrVal to obtain a BSTR output which it is similar to
LPCSTR, which is a wchar_t*, as far as I know...
But passing it directly obviously it doesn't compile... in this case what I
should do?

Thanks.
Ciao
Luigi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top