|
Hi,
I intend to integrate the functionality of two dlls into one by means of merging the code. I'm adopting the following steps.
1) Create a master framework for the merged entity say dll A.
2) Include all the files that are distinct for the two dlls(B & C) into the project created for dll A.
3) For all the files that are same in dll B and C, include a single file into the merged entity and into that file put all the functions that are distinct in the file under B and C.
I think this should suffice. Please correct if there is something to be done
The problem comes for functions that are same in the common file.
Say in dll B We have a function like
class B : function()
{
}
Say in dll C We have a function like
class C : function()
{
}
Here the two different functions need to be merged into a single function under a class name.
Now my question is how does the merged entity break into two workflows similar to the functional behavior in the previous separate dlls? What kind of conditional can be put for identifying the different behaviors?
Thanks
|
|
|
|
|
When you say they are two different functions then I feel there is no need to merge them as single function . Still , to do that just pass a boolean variable to function(bool flow) to determine which block of function() should be executed
redindian
|
|
|
|
|
how do i determine the boolean value
|
|
|
|
|
Hello everyone,
Could someone help me for how to open a RAS dial up using RasDial function knowing that
an adsl modem used, i wrote this code below
bool DialUp()
{
// Fill RASDIALPARAMS structure
RASDIALPARAMS rdParams;
rdParams.dwSize = sizeof(RASDIALPARAMS);
rdParams.szEntryName[0] = '\0';
lstrcpy(rdParams.szPhoneNumber, szPhoneNumberToDial);
rdParams.szCallbackNumber[0] = '\0';
lstrcpy( rdParams.szUserName, szUserName );
lstrcpy( rdParams.szPassword, szPassword );
rdParams.szDomain[0] = '\0';
HRASCONN hRasConn = NULL;
DWORD dwRet = RasDial( NULL, NULL, &rdParams, 0L, NULL, &hRasConn );
// Everything OK?
if (dwRet == 0)
return true;
// Error occurred - get error description and alert user
char szBuf[256];
if (RasGetErrorString( (UINT)dwRet, (LPSTR)szBuf, 256 ) != 0 )
wsprintf( (LPSTR)szBuf, "Undefined RAS Dial Error (%ld).", dwRet );
RasHangUp( hRasConn );
MessageBox( NULL, (LPSTR)szBuf, "Error", MB_OK | MB_ICONSTOP );
return false;
}
but when i excute the program i see the error message tell me that i have a bad modem configuration or modem port problem (my modem cofiguration is good)
any idea??
Thank you
---
Anyone who considers arithmetical methods of producing random numbers is, of course, in a state of sin.
John von Neumann
|
|
|
|
|
First thing to try is to properly initialize the RASDIALPARAMS structure before you use it.
bool DialUp()
{
RASDIALPARAMS rdParams = {0};
rdParams.dwSize = sizeof(RASDIALPARAMS);
...
|
|
|
|
|
It working fine when I tried this function to open the remote access service via telephone line and without adsl, But the function fail with adsl modem (USB cable), my question is:
does RAS dialing used for such connection ??(As you know most adsl connection use PPP protocol), beside that the DUN or WININET APIs are not important for me bcos i can set all connection configuration easily by filling RASDIALPARAMS structure ..
I welcome any idea
--
Anyone who considers arithmetical methods of producing random numbers is, of course, in a state of sin.
John von Neumann
|
|
|
|
|
Oh! damn!! the problem is self explained, i forgot that the RAS used for phone line and not for
adsl and particularly Virtual Private Network !
Thanks for help anyway
Anyone who considers arithmetical methods of producing random numbers is, of course, in a state of sin.
John von Neumann
|
|
|
|
|
Just wondering what the most compact way of writing this code is and how the c++ compiler implements the evalution order.
ps is a ptr to an unsigned char *
Under gcc-3.3.4 with -Wall there are no warnings with
*ps++=0xFF-*ps;
*ps++=0xFF-*ps;
*ps++=0xFF-*ps;
Under gcc-4 ps might be used unitialised.
The code below fixes the ordering problem But I was wondering if the LHS and RHS are evaluated in parallel in non deterministic order?
*ps=0xFF-*ps; ps++:
*ps=0xFF-*ps; ps++;
*ps=0xFF-*ps; ps++;
I would be interested in faster / more compact ways of doing this. Assembly?
I was also wondering without going to assembly if this is the fastest way of accessing the values in the register.
Thanks,
|
|
|
|
|
You're using ps in two parts of the expression, one of which has a side-effect. Don't do that.
Don't try to hand-optimize code unless you've profiled it and you know it's a bottleneck. You are not a better optimizer than the compiler writers. Making the code clear and readable is a much better goal.
|
|
|
|
|
Yes . The ps being on both sides has a side effect. I looked up the c++ standard but could not get any clarification on the order of the lvalue and rvalue computation in this case. Can you clarify?
It is most definately true that I am not a better optimiser than the compiler writers however apparently is is difficult for the compiler implementors to do very complex algebraic reductions as the following link shows. Experimenting with gcc -S and toggling -O2 yields some interesting results.
C++ Optimisation
Regards,
|
|
|
|
|
I tend to agree with Michael, probably not the place to worry about optimizing.
That said, i'd hate you to go away with nothing.
You could replace:
*ps = 0xff - *ps;
with:
*ps = ~*ps;
In assembly this will convert:
mov edx, 0ffh
sub edx, ecx
to:
not ecx
So, seeing as mov, sub and not are usually ~1 cycle you are probably only saving 1 cycle per use. Where you place the ps++ isn't likely to effect the resulting assembly, so make it clear rather than clever.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Thanks for the tip. I will take both your advice on board, however Optimisation does seem to be important in large scale image processing.
Regards,
|
|
|
|
|
i use WINAPI to built a DLL.There's a main dialog in it . when i want to open a new dialog according to a button on it, it failed . However i can if i use dynamic DLL to do it. How can I do? Thanx a lot.
|
|
|
|
|
hi
how i can create activex control include ather controls and activexs?
i user visual c++ 6
|
|
|
|
|
In the SQLExecute(hstmt) the hstmt is being passed to the Oracle ODBC 8i driver as an SQL_CHAR which is limited to 255 charaters. So if you have a large table requiring say 300-500 characters then your inisert or select statement will fail. Can anyone tell me if there is a way to fix this limitation? The Visual C++ side is using a CString object so it has more then enough size to handle the large statement. The problem is definately on the ODBC side. Any help on this matter would be greatly appreciated.
Thanks,
Charlie
Everything is Free... Until You Have to Pay for it...
Platforms Windows 2000/XP Professional using Visual C++ 6.0
|
|
|
|
|
Charlie Curtis wrote: ...as an SQL_CHAR which is limited to 255 charaters...
Where do you find this limitation documented? The text length parameter passed to
SQLPrepare()/SQLExecDirect()/etc. is a long integer - 32 bits.
Mark
|
|
|
|
|
Hi Mark,
Haven't really found any documentation per say I am going by the fact that when I trace through the code and I look at the string being passed to SQLExecute(hstmt) it is in fact limited to 255 characters. I have tried both the SQLPrepare() and SQLExecDirect() funtions as well, but always the same the string passed is 255 characters. So any further help here would be appreciated.
Thanks for replying to this message,
Charlie
Everything is Free... Until You Have to Pay for it...
Platforms Windows 2000/XP Professional using Visual C++ 6.0
|
|
|
|
|
Charlie Curtis wrote: when I trace through the code and I look at the string being passed to SQLExecute(hstmt) it is in fact limited to 255 characters
The string being passed or are you tracing into SQLExecute() and seeing it being truncated??
Are you passing the correct string length or SQL_NTS for the text length parameter?
Mark
|
|
|
|
|
Hey Mark,
I am passing SQL_NTS is that my problem?
Thanks,
Charlie
Everything is Free... Until You Have to Pay for it...
Platforms Windows 2000/XP Professional using Visual C++ 6.0
|
|
|
|
|
Not unless there's a _T('\0') at index 255 in your buffer
So the string is already truncated before the call to ODBC? If put a breakpoint at the call what's
in the string?
Mark
|
|
|
|
|
Yes Sir that is correct it is being truncated prior to the SQLExecute. It has 255 charaters of the string in it. It has 253 readable characters and I am assuming the \0 at the end. However, there is no reason for it to truncate at that point as it is a CString object. So it is reall freaking me out that it is doing that...
Charlie
Everything is Free... Until You Have to Pay for it...
Platforms Windows 2000/XP Professional using Visual C++ 6.0
|
|
|
|
|
hmm Can you show the code used to construct the string?
If you do this do you get more than 255 chars in your string?
CString str(_T(""));
for (int i = 0; i < 16; ++i)
{
str += _T("0123456789012345");
}
str += _T("This is past 256 chars");
|
|
|
|
|
No I get the same a truncated string ending at 901. I even created a brand new project to see if maybe it was something specific to the project I am workingon, but it truncates in the new project the same... Not getting it. I wouldn't think it would, but maybe you know better then I. Could it have something to do with this computer having a 64 bit processor? Just grasping at straws now...
Everything is Free... Until You Have to Pay for it...
Platforms Windows 2000/XP Professional using Visual C++ 6.0
|
|
|
|
|
Charlie Curtis wrote: No I get the same a truncated string ending at 901
Well I am clueless at this point
It's not ODBC if that helps any
I don't know whether or not there's issues with CString in 64-bit.
Here's an article about a CString-like implementation that maybe you can use
CString-clone Using Standard C++[^]
If I come up with something I'll let you know!
Mark
|
|
|
|
|
OK, I appreciate your time, and if I come up with what it is I will try to remember to let you know what it was...
Charlie
Everything is Free... Until You Have to Pay for it...
Platforms Windows 2000/XP Professional using Visual C++ 6.0
|
|
|
|