|
Thanks but i have allready tried and it has no effect
Scott Sims
|
|
|
|
|
Excuse my insistence, but that name mangling thing caught my eye... is your test program file actually called test.c and not test.cpp ? The compiler seems to be producing C++ code, not C. Also, the mhtwrapper.obj dump suggests that mht_associate is being compiled with extern "C" (not to be confounded with __cdecl ) name decoration.
If this is all obvious to you please feel free to ignore my post --but I thought it might be worth pointing out, just in case.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I think you might be on the right track but i am a little lost, the test file was called test.cpp and not test.c which i have now changed. The change in file type seems to make no ovious difference, i still get the same error. But when i try to add the extern "C" to the decloraction of the unresolved function i get the following error,
extern "C" void mht_associate(struct s1 **a,
struct s2 **b,
struct s3 *c,
int d,
double ***e,
int f,
int g,
int h,
int i);
g:\work\qunetiq mht\mhtwrapper.h(11) : error C2059: syntax error : 'string'
Thanks
Scott
|
|
|
|
|
OK... So you have to anwer yourself a question: Do you want the wrapper thing to work in C++ or in C? If it's the former, change everything to .cpp , forget about extern "C" , and everything should be right. If it's the latter, then you might be in trouble, cause that string seems to be C++ std::string , which of course cannot be included in a C program. Anyway, this is like walking in the dark a little code would go a long way.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I assume from what you are saying is that some code appears to be compiling as C++ and other code as C(I need platform independent pure C code) and the linker is struggling with this. So is there a compiler switch to force the compiler into pure C. Im sorry about the lack of code but unfortunatly that is unavoidable.
Thanks for your time
Scott
|
|
|
|
|
OK, pure C. Then, rename everything to .c , drop every extern "C" out and do a fresh rebuild (Project -> Rebuild All.) What's the result now?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Doing as you said had no effect but by adding \Tc to the compiler options forces pure C and i now have got the program running, thank you very much for your help it is greatly appriciated.
Scott
|
|
|
|
|
Well, you are welcome. Anyway, please note that you don't have to do anything special in VC++ to have .c files compiled as C. It is as if someone altered your VC++ settings to get the compiler to evilly treat .c files as C++.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
...but we think you're cool anyway Tim. Don't we guys.
guys?
cheers,
Chris Maunder
|
|
|
|
|
Sure... rub it in why doncha...
|
|
|
|
|
(Wild guess) Traces suggest C++ name mangling is in effect. Could it be you have to fix some extern "C" declarations somewhere?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have tried allready this with no effect, thanks anyway.
Scott Sims
|
|
|
|
|
You don't say if you're using MFC or WTL. If WTL, the LNK2001 error is caused when you try to do a Release build of a program that requires MSVCRT. Remove the compiler directive _ATL_MIN_CRT or remove the function call that requires the C RunTime library (malloc, printf, etc.).
|
|
|
|
|
I am using neither, it is just a C console application and im using a debug build, i also need to use the stadard C librays throughout the program.
Thanks Anyway
Scott Sims
|
|
|
|
|
Have you left the default setting of precompiled headers in the compile options? If so, turn it off and delete everything in your debug folder before rebuilding.
|
|
|
|
|
Have you look at this link at all?
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q148652
does it help?
|
|
|
|
|
I am using the follwing code to get the current system time and put it in HH:MM:SS format.
CTime launch_event_time = CTime::GetCurrentTime();
// decompose the current time into hours minutes and seconds
hours = launch_event_time.GetHour();
minutes = launch_event_time.GetMinute();
seconds = launch_event_time.GetSecond();
// format the time for display in both the track report
// and geolocation tables and store in a global variable
sprintf(launch_event_time_txt, "%02d:%02d:%02d",
hours, minutes, seconds);
What I also need is tenths of seconds. Can anyone lend a hand with this?
|
|
|
|
|
If I remember correctly, CTime is based on C's time_t type which doesn't support tenths of seconds. Which is just one of the many problems with time_t.
Try using SYSTEMTIME or FILETIME.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Use getSystemTime() instead and use the wMilliseconds field of the SYSTEMTIME struct to get tenths of a second.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I have a lot of problem (especially on windows 2000) to set focus input to the window I want in a multithread context (several threads manage windows)
I have found this remark in an MSDN article concerning SetForegroundWindow function :
Windows NT 5.0 and later: An application cannot force a window to the foreground while the user is working with another window. Instead, SetForegroundWindow will activate the window (see SetActiveWindow) and call theFlashWindowEx function to notify the user.
Is somebody can explain me what "while the user is working with another window" means exactly or where I can find it
|
|
|
|
|
This is a new GUI feature aimed at relieving the user from those apps that unsolicitedly put themselves on the foreground making the user lose the focus (which is annoying if one is for instance typing some text.) SetForegroundWindow will just show the associated taskbar button flashing to indicate the app requested attention.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Tanks for your response,
Do you know microsoft articles which deal with this purpose.
What you say is quite logical, but it seems to apply to multiapplication management but I have the sam effect in a single application. That is to say I try to give focus to a special window of my application but in another thread but I don't succed in changing focus and the taskbar is flashing
Gwenaël Dourmap
|
|
|
|
|
Hmmm... that's weird, according to the documentation you shouldn't have any problems changing the foreground window within the same process (as long as the process was the foreground process in the first place).
Anyway, take a look at http://www.mooremvp.freeserve.co.uk/Win32/w32tip33.htm for a little hack to get SetForegroundWindow working the way it did on older OSs (see method 2).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm trying to make an interactive batch file (.cmd) to run under Windows NT. The obvious way is to have a program that displays a prompt and sets an environment variable with the response - the batch file can then access the input value via the environment variable (as %environmentvariable%), however
1) using _setenv() only alters the environment for the current program, so the batch file that ran the program does not see the new variable; conversely
2) altering the registry where the environment variables are kept (HKEY_CURRENT_USER\Environment etc.) has no effect until a new DOS shell is started, so the batch file that ran the program does not see the new variable;
3) the old DOS method of getting the PSP and walking up the environment areas isn't allowed under NT (and there's never enough space in the environment area anyway);
If anyone knows how to write a program that can do this, or any other way of making a batch file interactive, I'd love to hear about it.
(PS I know that using VBS or some other scripting language is the right way to go, but I need this to run on any NT Server machine, and the CMD processor seems to be the only scripting engine that is guaranteed to be available)
Thanks
Dave
|
|
|
|
|
I don't know if modifying parent process' env block is possible. I'd give up setting the result in environment vars directly, instead, I'd write something to dynamically created .bat or .cmd file. If user enters 'foo', the file would look like this:
set var=foo
Main batch would call this file to make changes.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|