|
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
I have an ancient DLL that began life with VC++ 6. It also uses Zlib for compression, again VC++ 6.
Fast forward a boat load of years and I now have a test app in VS2019. Can't load the DLL. Cannot find old debug libraries, etc.
Given that you have a DLL, you don't necessarily have the ability to recompile it. Let's say we cannot for the moment. Am I left installing ancient SDKs so that those DLLs are available for my custom dll? Don't think how to fix this, I'm trying to understand how to manage MS's myriad versions of SDKS all over my laptop. What do you do to limit the insanity?
Next question - best, most sane approach to move forward? Seems to me I need to rebuild the dll, the test app, etc so they all sync up. But I'm concerned about my customer elsewhere in the world. Do they need to install and SDK? I suspect I need to create an MSI that includes specific runtime kits.
Appreciate any guidance.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Not sure if it will fit your case but here is how I got about a similar problem:
1. make a clean virtual machine (VMware, VirtualBox, whatever you want)
2. install your DLL and use DEPENDS to find what missing SDK libraries you need
3. try to run your test app and fine tune between different versions of SDK until you make it run.
The advantage of working on a VM is that you can go back to known snapshot points and not get the "it runs on my machine" situation.
Going forward, I'd say the best thing would be to rebuild your DLL with as little external dependencies as possible. Link everything, including the runtime libraries, as static libraries. That way you can distribute your DLL without worrying about needed SDKs.
Mircea
|
|
|
|
|
This is good advice, with one caveat.
Linking with static libraries will solve the problem only if the only parameters passed between the caller and the DLL are simple objects (char, int, ...), pointers to simple objects, or pointers to arrays of simple objects. If you try to pass something like a FILE*, there is no guarantee that the caller and the DLL agree on the format.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
You could try running the code with modern libraries, and it is possible (although less probable) that it would work. But much safer to rebuild completely, since the dependencies are often hidden deep in the libraries or OS. One thing you may like to consider is whether you really need your library as a DLL rather than static. The only advantage of using a dll is in situations where you have multiple active applications that are all calling in to it. If it is only used by a single application then a static library, or even no library, is a better choice.
|
|
|
|
|
By any slim chance, does anyone have the code for triangular plate bending finite elements? I'm looking first for the stiffness matrix. I can read C, Fortran, python, Java and probably figure out some others. Any help would be appreciated - Thanks, Ed
|
|
|
|
|
You seem to think there's only one way to write that kind of code.
And, no, nobody is just going to hand over there hard work writing that kind of code, unless they want to publish it on the web. In that case, Google is your best friend.
|
|
|
|
|
In earlier 70s I used one of such types of triangle thin bending elements (so called "incompatible elements").
The base knowledge about FEM I got from the O.C. Zienkiewicz book: it called somehow like "finite element method in engineering science" or similar. There were some ideas of to implement this type of element and a lot of Fortran code examples 9very simple but very useful!)
Not sure you will be able to find in Web something useful about it, but just try!
As for me, I have lost all my sources (punch cards desks and listings) many years ago.
|
|
|
|
|
Victor, I have that book and many others. I've written the code for quadrilateral plate elements (also when we used punch cards) but I have a client that wanted something quickly. I just thought I'd ask and try to save myself a couple of days. Thanks.
|
|
|
|
|
I create an application in C++(MFC) but I did not find a way to design a report in VS2019 toolbox;
please can anyone help with an example in how to create or generate a report in C++/MFC;
thanks in advance;
|
|
|
|
|
What kind of "report" do you mean?
|
|
|
|
|
a FMC program to calculate electricity bill then print out a report with a header and footer
|
|
|
|
|
Do you mean something similar to CR-report?
Or just a List Control (MFC CListCtrl) in report (Detail) style?
|
|
|
|
|
|
|
I find it easier to create an HTML file that I can format, and then open that file with the default browser. The user can then print at their discretion.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
How can I know the version of an console application executable ? (obviously, this exe is not made it by me)
|
|
|
|
|
Unless the executable contains version information you can't. It is possible to add version information in a resource definition file when building a console app, but few people do so. Right click the .exe and check the properties.
|
|
|
|
|
Yes, I have checked properties in Windows, Explorer, but show me nothing. I thought there is another way to find it.
|
|
|
|
|
In that case it does not contain 'standard' version information. There may be other information held in the program but only the creators will know where it is.
|
|
|
|
|
does it have by chance a "-v" or "-version" or "/version" command line parameter ?
I'd rather be phishing!
|
|
|
|
|
How do you know that such executable actually has a version?
"In testa che avete, Signor di Ceprano?"
-- Rigoletto
|
|
|
|
|
Have you looked at the date field in the PE header?
See PE Format - Win32 apps | Microsoft Docs[^]
It’s not exactly a version information but it might give you an ordering of the different versions. That’s assuming the linker used to create the app bothered to fill it. Most, but not all, do.
Mircea
|
|
|
|
|
Hi!
I try to implement a callback function within a dll, which triggers an assigned function in the main application. I want to trigger this "event" in the main app from within the dll.
Here is my code from the dll:
extern "C" __declspec(dllexport) void funcA(const unsigned long long a, const unsigned long long b);
extern "C"
{
typedef void(__stdcall* callback_t)(unsigned int halfbeast);
__declspec(dllexport) void public_func_taking_callback(callback_t evHnd)
{
evHnd(333);
}
}
void funcA(
const unsigned long long a,
const unsigned long long b)
{
if(a>10)
callback_t(public_func_taking_callback);
}
Here is the code I use in the main application to load the library and attach to the functions:
typedef void (__stdcall *eventCallback)(unsigned int miau);
typedef void (__stdcall *setCallback)(eventCallback evHnd);
void __stdcall CallB(unsigned int);
void __fastcall TForm1::Button1Click(TObject *Sender)
{
signed int retval;
unsigned int i;
char txt[7];
unsigned long long a,index;
UnicodeString USt;
HINSTANCE dllHandle=NULL;
dllHandle = LoadLibrary(L"test.dll");
if (!dllHandle){
ShowMessage("Could not load test.dll");
Form1->Close();
}
else{
void (__stdcall* funcA)(const unsigned long long a, const unsigned long long b);
funcA=(void(__stdcall*)(const unsigned long long a, const unsigned long long b))GetProcAddress(dllHandle,"funcA");
setCallback values=(setCallback)GetProcAddress(dllHandle, "public_func_taking_callback");
if(values != NULL){
values(&CallB);
}
if(!funcA){
Memo1->Text="No handle to function found.";
}
else{
funcA(1,1);
funcA(100,100);
}
FreeLibrary(dllHandle);
}
}
void __stdcall CallB(unsigned int halfbeast){
ShowMessage("triggered");
}
What happens is unfortunately not what I wanted:
1) In the very moment the line "values(&CallB);" is executed, CallB is called. This is not what I wanted, I justed wanted to give the callback pointer of the dll to my function CallB.
2) CallB is not called when the line "funcA(100,100);" is executed. Most likely there is something wrong with the function call within the dll, but I cannot see it...
|
|
|
|