|
subramanyeswari wrote: xlen_funct = NC_xlen_string ;
where first one is function defined as int (*xlen_funct)() ;
second one is function defined as int NC_xlen_string(NC_string *cdfstr)
then if the 2 propotypes are different, you cannot assign one to the other...
|
|
|
|
|
hi,
i am writting wrapper over C++ functions to call them in C. the problem is with return type const char*. it is compling properly. but it cant find dll entry point for the function.
the function in .h file is
const char* __declspec(dllimport) __stdcall myfunction(par1, par2);
i am using Visual Studio 2005 IDE. when i move mouse cursor over myfunction it shows return type as int.
what is the problem?
|
|
|
|
|
huuuuu, a wrapper on C++ functions for C ?
isn't it the opposite that we usually do ?
what kind of functions are you wrapping ?
moreover, you say that the dll entry point is not found. in what is this related to const char* ?
|
|
|
|
|
You need to specify C linkage instead of C++ linkage. To specify C linkage, use extern "C" for function declarations:
extern "C" const char* __declspec(dllimport) myfunction(par1, par2); Also, note that the dllimport should be dllexport if you're compiling the DLL project.
To check what is being generated, use the dumpbin command-line utility: dumpbin /exports mydll.dll. You can also use this on .lib file.
Be sure you are pointing to correct lib/dll in your project - otherwise you will waste a lot of time trying to figure out why changes are not showing up.
Best wishes,
Hans
|
|
|
|
|
Hello experts!
Not really a visual C++ question, but can anyone of you show or provide me a ftp interface I can use within a C++ unix program. I found the excellent CFTPClientClasses here on Codeproject, but don't get it compiled without major changes ( which I have no time for) on unix. Destination system is SUN Solaris 9, Forte Developer 7 compiler. Any hint is welcome. Thanks!
-- modified at 9:38 Monday 7th May, 2007
|
|
|
|
|
A while back I saw a C++ FTP class on SourceForge - don't remember the name right now. Try a search.
|
|
|
|
|
|
MarcoNedwig wrote: I found the excellent CFTPClientClasses here on Codeproject, but don't get it run on unix.
It compiled, but wouldn't run?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry I wrote it incorrectly. I couldn't compile it with major changes.
|
|
|
|
|
Ok, so what does CFTPClientClasses() do internally? Does it use a platform-neutral API?
MarcoNedwig wrote: I couldn't compile it with major changes.
What major changes did you make such that you couldn't compile it?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
It has a platform independent api. You can see the article here :
http://www.codeproject.com/internet/ftpclientclass.asp
|
|
|
|
|
Hi,
I need to change the text color of a group box, How to do??
I did as as below
HBRUSH C3DColorCardDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
pDC->SetTextColor(EFC_RGB_WHITE);
if(nCtlColor==CTLCOLOR_STATIC)
{
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(EFC_RGB_WHITE);
return m_hbrDlgBkGnd;
}
}
but no use.
Any suggestions would be helpful.
Thanks in Advance
Today is a gift, that's why it is called the present.
|
|
|
|
|
Take a look at WM_CTLCOLORBTN .
Best wishes,
Hans
|
|
|
|
|
...or replace CTLCOLOR_STATIC with CTLCOLOR_BTN in your code.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hi !
Everybody !
sorry to ask a question on thread.kindly can any body guide me. can I debug multithreading application?
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
Why not?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
May I ask you one more question on thread?
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
hum, i'd say go ahead, as we're on the forum for it...
if you don't ask, we won't be able to answer.
but if the question is not respecting the guidelines, be ready to be flamed ! lol
|
|
|
|
|
Thank you sir!
sir when I debug my application. As I debug, all the handles created properly for threads and I have pass the structure pointer (paramters) but value passed through the pointer is same at each call .
what should i do?
should I have to take array of pointers for struct varibale?
-- modified at 9:50 Monday 7th May, 2007
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
i'm not sure i get your english very well...
can you show a piece of code that reproduces the problem ?
|
|
|
|
|
sorry for my english,
better with snippest,
<br />
for(int i=0;i<3;i++)<br />
<br />
<br />
struct argument_list *l ;<br />
l=(argument_list *)malloc(sizeof(argument_list));<br />
<br />
l->pszInFile=bufferwithpath;
l->pszOutFil=w_Output;
<br />
l->_ProtectSet=_ProtectSet;<br />
l->hList=hList;<br />
strcpy(l->Host,HOST);<br />
l->hwndEncrypt=hwndEncrypt;<br />
l->hWndinoutfiledir=hWndinoutfiledir;<br />
l->hwndParent=hDlg; <br />
<br />
strcpy(l->InitPackageRequest,sINIT_PACKAGE_RESPONSE.c_str()); <br />
l->Port=PORT;<br />
<br />
strcpy(l->ScriptFile,COMMUNICATOR_SCRIPT_FILE_PATH);<br />
<br />
strcpy(l->UserID,UserID.c_str()); <br />
hThread[i]=(HANDLE)_beginthread(&Thread ,0 , l );<br />
}<br />
<br />
WaitForMultipleObjects(3, hThread, FALSE, INFINITE);<br />
<br />
below is thread function.
<br />
void Thread(void* pArguments )<br />
{<br />
if( pArguments == NULL )<br />
{<br />
MessageBox( NULL , _T("Problem in thread") , NULL , IDOK ) ;<br />
<br />
}<br />
<br />
HRESULT hr=NULL;<br />
struct argument_list *Lparam= (argument_list *)pArguments ;<br />
Package pkg;<br />
static int threadID;<br />
threadID++;<br />
<br />
<big>{ <br />
hr=pkg.EncodeMediaContent(Lparam->pszInFile,Lparam->pszOutFil,Lparam->hwndParent,Lparam->Host,Lparam->UserID,Lparam->InitPackageRequest,Lparam->ScriptFile,Lparam->Port,Lparam->hList,Lparam->_ProtectSet,Lparam->hWndinoutfiledir,Lparam->hwndEncrypt);<br />
}</big><br />
<br />
<br />
<br />
if(hr==S_OK)<br />
{ <br />
MessageBox(0,L"thread gone finished" ,L"therad",0);<br />
_endthreadex( 0 ); <br />
}<br />
<br />
threadID--;<br />
<br />
}<br />
<br />
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
amitmistry_petlad wrote: l->pszInFile=bufferwithpath; //each time got the same values in the thread function.
l->pszOutFil=w_Output; //time got the same values in the thread function.
If you put the same values in your argument_list structs, then you'll get the same values in
every thread proc.
Unless something is missing in the code you posted, I can't see you putting anything different
in the 3 structs.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
sir, I have made the walkthru but it is some what long so I afrid to put it in the
fouram.
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|
|
OK. But you show this in your code...
l->pszInFile=bufferwithpath; //each time got the same values in the thread function.
l->pszOutFil=w_Output; //time got the same values in the thread function.
If these values are the same all three iterations through the loop, and you don't expect them
to be the same, then that's the problem.
My point is, you don't show where those values come from in your code so we can't help you with
that part
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Mark Salsbery wrote: l->pszInFile=bufferwithpath; //each time got the same values in the thread function.
l->pszOutFil=w_Output; //time got the same values in the thread function.
Dear mark,
for the above I got the values different but when the therad started and go in the thread function there is one function which I shown bold that shown me the same value each time and call that function with same value .
suppose.
there are two thread and both call the function Thread . in loop when the values shown different in structure pointer l but when thread call each it get the last value of listview. it means first values for each thread called in the structure pointer l . how can i handle that one?
can you give me some guideline.Please ...
"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India
|
|
|
|