|
I don't think you are following Micro$oft's recommendations.
I just checked MSDN and it says to use __stdcall for FORTRAN functions.
For more info search for mixed-language programming in the MSDN docs.
__________________________________________
a two cent stamp short of going postal.
|
|
|
|
|
Note, you don't *have* to use a DLL for this to work. You can simply link all the stuff together. You do have to take into account different parameter passing mechanisms (e.g., C++ strings do not map to Fortran strings!) but that is the same as if you use a DLL.
I don't remember all the details, though, so I'm useless. But I think if you have a Fortran compiler that links into Visual Studio (they exist), you can do this relatively painlessly.
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
The group I'm working on the code for wants it as a DLL so I don't have much of a choice.
|
|
|
|
|
I am new to C++. When would someone choose to use a static over a dynamic or the other way around?What exactly is the difference between to two? Thanks a lot
|
|
|
|
|
There are multiple things in C++ that can be 'static' or 'dynamic'. If none of the following match your situation, you should consider reposting and clarifying the context a little more. Like, "Where, in what context, were these words mentioned ?"
Most commonly, these two refer to the way a variable is stored in memory. When a variable is considered 'static', it is stored in the local stack memory. Each process that executes in a Win32 environment is allocated a piece of memory for it's private purposes. This memory is known as 'stack'. It cannot be directly accessed by any other application, it is private to the process in question. When a stack variable goes out-of-scope (a function where the variable was declared is finished), it is automatically destroyed and freed.
The alternative to 'static' variable is a 'dynamic' variable. At this point, the variable is stored in heap memory. This heap memory is considered all the RAM memory on your computer that is not process-specific. It is available for use by different processes. Each process can reserve a slice of this memory, use it to store a variable, and then release the memory when it is no longer needed. A heap variable never goes out-of-scope. You must manually reserve and release the associated memory. Failing to release memory will lead to memory leaks.
The actual C++ keyword, static , when used with a variable, creates a scope-independent variable. This means that when you create a static variable inside a function, and then at some point re-call this function, the variable is automatically initialized to the value it was when the last function execution ended. So to speak, the variable is not 'lost' when it goes out-of-scope.
All in all, I suggest you grab a good C++ -book and read it through with thought. C++ is quite difficult at start, but when you get a grasp of it, it becomes like a second language
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
If you are referring to the AppWizard's question about the MFC library, then it is asking if you want the MFC library completely embedded into your application or whether you want to access MFC via a DLL (Dynamically Linked Library). From a programming point of view, there is no difference.
Static linking makes the application more portable to weirdly configured machines (such as those with ancient MFC libraries or missing them altogether) but seriously increases the size of your application.
|
|
|
|
|
Hi,
I'm trying to prompt the user when he clicks close off my menubar (MFC SDI) so i set an OnFileCLose() function (using resources-tab), but when i run the program it does not enter the function, it just closes without hitting my messagebox.
i'm sure there's a very easy solution to this, if anyone has thoughts please let me know. I will owe you a coke.
thanks,
Mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
OnFileClose() is used to handle the File|Close operation, not File|Exit. The simplest way to handle the exit is to add a handler for the WM_SYSCOMMAND , and look for a parameter of SC_CLOSE . You can find the details in the MSDN[^].
Software Zen: delete this;
|
|
|
|
|
Sorry, (File|Close) is actually what i am trying to do. I want it to close the current document and reset all the values. however when i click File->Close, the program exits and does not enter the OnFileClose function.
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
Hi,
I am able to get all the computers connected to a network.
Now my next step is to track the list of patches in these computers.
For this to achieve -pls advise me how to proceed.
Pls correct me if I am going wrong.
1.Detect type of OS on the target machine .
2.List the patches present on the target machine.
3.List out the dependancies of each patch.
For that-Do I need to know the list of softwares on the target machine?
-Do I need to know the list of service packages on the target machine?
-How a patch is detected on the target machine?
-How a patch is applicable on the target machine?
Regards
|
|
|
|
|
ykutanoor wrote:
1.Detect type of OS on the target machine .
GetVersionEx() should help here.
ykutanoor wrote:
2.List the patches present on the target machine.
Do you mean like the ones listed here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
In order to list the patches present on the system -
I have to go through this path.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\Windows 2000\SP5
But in my machine
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Updates\
I am able to see 3 entries-
Data Access
Windows 2000
Windows MEDIA pLAYER
And under Windows 2000 -I am seeing 2 entries SP4 and SP5.
And in the path -
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
I am able to get a list of hot fixes.
What are hot fixes and are these patched?
Regards
Ydagiri
cAN U PLS HELP ME WITH THIS ONE?
I am doing a multi threaded application that involves exchange of data.
ONE UI THREAD
AND 3 WORKER THREADS.PLS LET ME HOW TO EXCHANGE THE DATA BETWEEN THESE 3 WORKER THREADS.
FOR EX:THE FIRST THREAD WILL GIVE THE SECOND THREAD THE 2 NUMBERS AS ARGUEMENTS.the second thread should return the first thread the sum.
Pls help
|
|
|
|
|
ykutanoor wrote:
I have to go through this path.
I was simply giving you that registry key as an example. It was not meant to be applicable on all systems.
ykutanoor wrote:
And under Windows 2000 -I am seeing 2 entries SP4 and SP5.
Ok, and?
ykutanoor wrote:
What are hot fixes and are these patched?
Updates that are sent out in between two normally scheduled updates (e.g., critical issue or vulnerability found).
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have a 3rd party program that when runs leaks memory in each call. The programm is running always. Is there any way to clean p the memory leaked by the program, any source help will be highly appreciated.
Tariq
|
|
|
|
|
I suppose you dont have the source.
Contact 3rd party program creator , maybe he has a newer version.
If you have modification rights (i doubt) you can try to patch it at the assembly level
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Tariq878 wrote:
I have a 3rd party program that when runs leaks memory in each call.
changed 3rd party if possible, more so if you're paying for it.
also, what do you mean by in each call ? each time you call it ? is it a DLL or something that you call an it allocate memory that you are in charge of freeing ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
If the program is allocating memory but failing to dealloocate it when done, there's nothing you can do about this. The code will need to be changed. Your only recourse would be to stop/start the program every once in a while so that Windows will clean up the mess.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hi,
Anybody know how to include a picture in an excel sheet using VC++. I
can use AddPicture but it seems not supported by EXCEL 2003 object
model. Also, is there any way to insert the picture without explicitly
specifying the size of the picture?
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
Hi,
I am trying to add MRU files in my application.For this I have defined an array and storing file names there.
Then I use InsertMenuItem API to insert file name in Menu.But it does not seem to work.I want to insert MRU files like we have in word , excel etc.
Is there any API through which I can collect MRU list from registry and then display them in Menu.
Thanks in Advance
|
|
|
|
|
Are you using MFC?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
No I am not using MFC. I am using win 32 SDK
|
|
|
|
|
Post the code your using to do that
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Please find attached code, Let me explain what I am doing.
I am storing file names in an array List[],Then I want to insert stored value in File menu at 10th position.For this I am using.
InsertMenuItem(ghMenuBar,10,TRUE,&MI);
Following error is coming
"The parameter is incorrect"
if(strcmpi(List[Count],szFileTitle) != 0)
{
strcpy(List[Count],szFileTitle);
// Result = GetMenuItemCount(ghMenuBar);
MI.fMask = MIIM_TYPE;
MI.fType =MFT_STRING;
MI.dwTypeData = List[Count];
MI.cch = strlen(List[Count]);
Result = InsertMenuItem(ghMenuBar,10,TRUE,&MI);
if(Result == 0)
{
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
// Display the string.
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
// Free the buffer.
LocalFree( lpMsgBuf );
}
DrawMenuBar(hMainWnd);
Count++;
if(Count > 3)
{
strcpy(List[0],List[1]);
strcpy(List[1],List[2]);
strcpy(List[2],List[3]);
strcpy(List[3],szFileTitle);
}
}
|
|
|
|
|
I have moved a project - MFC - from VS6 to VS.NET 2003 and I can still compile the project in VS6.
In Debug I use incremental linking, and my project contains 10 libraries creating an exe file of 12.5 MB in debug (5 MB in release).
If I only touch a file, it will take 2 minutes and 30 seconds using 500 MB of memory to create the library and link using VS.NET 2003.
If I use VS6 and do the same thing it takes 20 seconds using maximum 20 MB of memory??
In VS6, MFC42 is used and in VS.NET 2003 - MFC71 but should the differance be so extreme?
_____
The incremental linking is not disabled and seems to work if I touch one of the files included in the main project file (this project only includes three cpp-files). Then the build takes about 30 seconds, rather reasonable. If I touch an obj file included in one of the lib's that the main project depends on - again the incremental build seems to work, the lib is rebuilt, but the linking takes "no" time.
But still - for no obvious reason if I touch any cpp file included in any of the libs, the obj file and then the lib are built, I will get a 2 minute linking when the exe is built from the lib's.
|
|
|
|
|
i want know how to set maximize button and minimize button to propertysheet.
M.Kailasam
|
|
|
|