|
See Dear,I m very new to MFC and once again let me clear u the picture.I m creating plugin for 3ds max in MFC (.dlu).And as i know is onlu about export and import for variables,func... by using __declspec(dllexport) int temp = 0;
So this is the scenario:
I m creating two dll in MFC.I want to share a varible between two.I Exported from one DLL by specifying _declspec(dllexport) int temp = 20;
in header file.
And I copy the .dll and .lib file in second dll (debug folder and also header file of first dll to second dll.I also specify the .lib file in the link path in project settings of second dll.I imported in second dll by __declspec(dllimport) int temp;
Now the problem is If i made any changes on temp variable in first dll then it is not updating in second dll,the second dll always considering temp as 20.
Please suggest me some easy way .
Thanks
Yogesh
|
|
|
|
|
I cant find your reply but did you see my link I think it solves your problem.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
See here[^].
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I try to send some data from my multiproject, from C++ to C# but i keep getting the error:
: cannot convert parameter 1 from 'System::Double ^' to 'System::String ^'
Been working all night with trying to find the solution, but im at a loss. Here is the essential part of the code:
C++ part: (this is a mod from a tutorial)For further reading[^]
TestCSharpLib1::CSharpClass ^ csharpClass = gcnew TestCSharpLib1::CSharpClass();<br />
<br />
marshal_context ^ marshalCtx = gcnew marshal_context();<br />
<br />
System::Double ^ d = marshalCtx->marshal_as< double >( static_cast< double >( In2 ) );<br />
<br />
csharpClass->Text = d;
And the C# part:
namespace TestCSharpLib1<br />
{<br />
public class CSharpClass<br />
{<br />
private double _text;<br />
<br />
public CSharpClass()<br />
{<br />
_text = 0;<br />
}<br />
<br />
public CSharpClass(double text)<br />
{<br />
_text = text;<br />
}<br />
<br />
public System.Double Text<br />
{<br />
get { return _text; }<br />
set { _text = value; }<br />
}
Any help appeciatet!
|
|
|
|
|
It seems like code from two examples was mixed together. What are you trying to do? (And if it's dealing with C++/CLI, you may want to ask in that forum.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Looking at it isolated, im just trying to send a double value back and forth between C++ to C# and back again...
The background problem is as:
Im getting a double input to a dynamic link library (the c++ snippet) from a third app, then i need to forward that input to the c# code, which will then do some stuff in a fourth app (matlab), and return the result C# and then to the C++ which will then return to the app. The app only supports dynamic link libs with a specific header (EES its called) and thus i cannot "just" use the C# code - And the Matlab code is in .net so i cannot use just C++ either.
I will try declaring a different data type as advised, so far i cant get it to work with (double) d : /
|
|
|
|
|
That happens because you are trying to assign between reference and value types.
You can cast it like:
csharpClass->Text = (double) d;
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Thanks you for the answer, took me a while to figure out what you meant, but once that happend, it all made alot more sence - its impresive how bad with c++ i was just 48 hours ago..
@those who complain about the wrong forum - Sorry, but on the bright side i even made it as far to actually knowing why its the wrong one!
|
|
|
|
|
Try
csharpClass->Text = d->ToString();
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
You fell into the trap. I was about say something like that , later realized "Text" is of type double too.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Ah - should read the original post more thoroughly.
I should have gone with my stock 'Managed C++' answer - you're posting in wrong forum - get outta here!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: I should have gone with my stock 'Managed C++' answer - you're posting in wrong forum - get outta here!
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Hi,
Thanks in advance
how can i link multiple shared libraries o.s linux
Appreciate help
Thanks
al
|
|
|
|
|
#pragma comment(lib,"your_first_lib")
#pragma comment(lib,"your_second_lib")
I don't know if it's valid in your compiler. You can also ask it Here[^]. Haunted though
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
what about 'man g++' ?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
In general, Linux libraries have names of the fgorm libname .
What yopu need to do is a) set the environment variable LIBRARY_PATH to include the directory you want (e.g. export LIBRARY_PATH = /usr/local/lib:$LIBRARY_PATH and b) add option -llibrary-name to your gcc or g++ comamnd-line. Simple as.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
Hello all,
I really must be missing something here, as all my attempts to terminate explorer.exe all end up with it restarting. I am calling TerminateProcess on explorer.exe, and the call IS working. However, explorer.exe just ends up starting up again.
But when I terminate explorer.exe from taskmgr, it doesn't restart.
Why is this happening? And how can I prevent the restarting?
Thanks in advance.
|
|
|
|
|
Um...Just for the record, terminating explorer.exe is generally not a good thing. And keeping it from restarting is even worse!
explorer.exe is basically the user-interface part of Windows. If it is terminated, it will keep the end user from using the taskbar and desktop icons while ticking him/her off. And if it doesn't restart, the end-user will have to manually start it again.
That being said, I will now try and answer your question.
Windows is programmed to restart explorer.exe when it is terminated by any means other than shutting down. If anyone knows how to keep it from restarting, I highly doubt that they will tell you. Leave explorer.exe to Microsoft.
Come on! Get down with the sickness! - Disturbed
|
|
|
|
|
I know very well what I am doing by terminating explorer.exe, and I can assure you I have a good enough reason to be doing it.
Kenny McKee wrote: Windows is programmed to restart explorer.exe when it is terminated by any means other than shutting down.
How exactly does taskmgr manage to kill explorer?
|
|
|
|
|
It appears as though the required functions to do this are part of the OS, and can't be used based on this forum[^]. That is what I gather anyway.
I didn't mean to make it appear as though I was insulting your intelligence. I just wanted to be sure that you knew the dangers.
How many bytes of text have I typed in my lifetime??? Man, I wish I kept track...
|
|
|
|
|
Oh it's alright. I expected some suspicion anyways
I read an article a few minutes ago on cleanly shutting down explorer.
The way to tell Explorer to shut down is to say you want to shutdown the machine, but then cancel in a special way:
Start->Shutdown->CTRL+ALT+SHIFT+Cancel
If I were to monitor explorer.exe, would I be able to see the function calls that do this?
EDIT: I don't think I can. explorer just ends itself like any other app.
New question: Would it be possible to inject something into explorer and call ExitProcess(0) within the process?
Thanks a lot for your help
modified on Monday, March 16, 2009 2:56 PM
|
|
|
|
|
The forum that I gave you the link to seems to say something about replacing explorer.exe, but I haven't went very in depth with that and it sounds like it might cause quite a few problems.
How many bytes of text have I typed in my lifetime??? Man, I wish I kept track...
|
|
|
|
|
First TerminateProcess is not good way for close a program why?
MSDN:
All object handles opened by the process are closed.
All threads in the process terminate their execution.
The state of the process object becomes signaled, satisfying threads waiting for the process to terminate.
The states of all threads of the process become signaled, satisfying threads waiting for the threads to terminate.
The termination status of the process changes from STILL_ACTIVE to the exit value of the process.
Terminating a process does not necessarily remove the process object from the system.
A process object is deleted when the last handle to the process is closed.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Thanks for your reply Hamid.
I can assure you that TerminateProcess will be my last resort in attempting to kill explorer
The thing is, I don't want to send a WM_CLOSE message to explorer.exe, as that brings up the Windows shutdown prompt. Is there any other way I can exit explorer.exe, excluding "tskill explorer"?
|
|
|
|