|
Hello everyone,
The PRIVATE keyword of module definition file (.DEF) means,
http://msdn2.microsoft.com/en-us/library/hyx1zcd3(vs.80).aspx
--------------------
The optional keyword PRIVATE prevents entryname from being placed in the import library generated by LINK. It has no effect on the export in the image also generated by LINK.
--------------------
My questions are,
1. Does it has any practical usage to prevent the exported function from import library file?
2. If the exported function is not in the import library file, then other component has to use LoadLibrary and GetProcAddress to use the DLL, other than using implicit link?
thanks in advance,
George
|
|
|
|
|
1. You can resolve strange linkage errors in a multi-module project by using PRIVATE in the DEF file of a mdoule whose function does not need to be in the library but is accessed otherwise by LoadLibrary and GetProcAddress. Think of it as reducing the name-space pollution, when necessary.
2. Yes - depending. However, if your process is already implicitly linked to this same module, you can use GetModuleHandle followed by GetProcAddress.
|
|
|
|
|
Thanks Blake,
1. Could you show a simple sample please? I do not quite understand what do you mean *name-space pollution*?
Blake Miller wrote: 1. You can resolve strange linkage errors in a multi-module project by using PRIVATE in the DEF file of a mdoule whose function does not need to be in the library but is accessed otherwise by LoadLibrary and GetProcAddress. Think of it as reducing the name-space pollution, when necessary.
2. You mean even if the method is PRIVATE, we still could use the generated import library file (.lib) and implicit linking to access the PRIVATE method of the DLL? If yes, could you show some pesudo code please? In my current limited knowledge, I think to access the PRIVATE method, we could only use LoadLibrary and GetProcAddress.
Blake Miller wrote: 2. Yes - depending. However, if your process is already implicitly linked to this same module, you can use GetModuleHandle followed by GetProcAddress.
regards,
George
|
|
|
|
|
George_George wrote: Does it has any practical usage to prevent the exported function from import library file?
same as having a private function in a class for example. it prevent the function from being usable from outside, the it's still available internally.
George_George wrote: If the exported function is not in the import library file, then other component has to use LoadLibrary and GetProcAddress to use the DLL, other than using implicit link?
not, if it's private, it's not hidden, it's just unavailable from outside the DLL, whatever linking method you're using...
|
|
|
|
|
Thanks toxcct,
I am confused from your reply. Seems you mean the PRIVATE method is not accessible from outside (e.g. other module -- EXE or DLL)?
But for COM DLL, we usually use PRIVATE in .DEF file to describe the functions exported to other module, like DllGetClassObject.
regards,
George
|
|
|
|
|
i'm using 'Dan Pilat' printing made easy article in my Dialog based application and its working perfectly.But how do i stop the printing when the text is over, actually i'm using the print function for printing the bill. so it should stop the printing after the bill is over, i'm not using his header and footer part.
Kindly reply,
thanks in advance.
|
|
|
|
|
You can use of EndDoc or EndPage.
|
|
|
|
|
Hello everyone,
Could anyone recommend some tutorials about safearray please?
http://msdn2.microsoft.com/en-us/library/ms221482(vs.80).aspx
thanks in advance,
George
|
|
|
|
|
Do you like to read this[^]?;)
|
|
|
|
|
Thanks Hamid,
regards,
George
|
|
|
|
|
|
that would not be so hard to find out by your self, isn't it ?
si, here is a starting point[^]. enjoy
|
|
|
|
|
<br />
int CChildView::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
m_pQuickSearchDlg->Create(IDD_QUICK_SEARCH,this);<br />
return CWnd::OnCreate(lpCreateStruct);<br />
}<br />
When I use GetParent in CQuickSearchDlg, it returns a point of
CMainFrame. How can this be?
|
|
|
|
|
From VC help:
"
pParentWnd
Points to the parent window object (of type CWnd) to which the dialog object belongs. If it is NULL, the dialog object’s parent window is set to the main application window.
"
And in the hierarchie chart, CDialog hangs from CWnd, at the same level as the CView. So I find not so extrange that it gives the CMainFrame as parent.
If you want another result, wha don't you try to use SetParent in the OnInitDialog () ?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hi all,
I have a CString in binary values. I want to read it to find some data, not from the beginning. Say like this,
I want to skip first 8 bytes. Then read the next 16 bytes. Then skip next 5 bytes and read the rest. That mean I want to move the reading position of the CString on it. How can I do that.
I know that if I use a CFile I can use seek(). Is there any smiler way to do it.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Rather than using CString use BYTE * or char *
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Actually according to my application it is so easy to use as char *, as a buffer. Is it easy for my requirement?
I appreciate your help all the time...
Eranga
|
|
|
|
|
Take a look at the Mid function[^] (and similar functions like Right and Left
EDIT: BTW, in the documentation there's always the list of all available methods. And in general, the name of the functions are quite explicit.
|
|
|
|
|
Hmm, thats seems to me easy. I'll try it now. Let see. Thanks pal.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Hello all,
I want to count perticular character in String.
I had made it by for loop but it takes to much time. Is there any in built function availale?
Thanks in advance.
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
If you want to get length of a string you can use of CString::GetLength().Is this your question?
|
|
|
|
|
No,
I am using BYTE * and i want to know how many times perticular char is repeated in that buffer.
Any idea?
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Why are you using a BYTE array to store characters ? Do you need to store characters or unsigned characters ?
Can you post the code of your loop, because it shouldn't take too much time to check each character of your string (except if it is exceptionally long).
|
|
|
|
|
I am storing bytes in buffer. And its too long. Thats why i need for in built function.
Any idea?
i had done like this:
int countByte(BYTE *src, BYTE b)<br />
{<br />
int count = 0;<br />
for(int i = 0; i < strlen((char *)src); i++)<br />
if(src[i] == b)<br />
count++;<br />
return count;<br />
}
Any Suggestion..
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Is your buffer NULL-terminated ? If no, then there is a big problem because strlen calculates the lenght of the string by counting the number of characters until it finds a 0.
|
|
|
|