 |
|
 |
How do criticalsection works across process ?
|
|
|
|
 |
|
 |
Fantastic article and excellent demonstration code. I'm a complete C newbie and still managed to understand what is happening here. Thrilled to have my code working, thanks so much Phil, there should be a button for "buy author a beer" on here.
|
|
|
|
 |
|
 |
Hi, my problem is more or less same. A function in the Dll has to be called only once, but how would another application know whether it has already been called?
|
|
|
|
 |
|
 |
It can be handled using the same approach as discussed in the example above. in the shared data segment a flag variable can be set when ever the function ges called...in the another process before calling the funtion, the process can check the flag to know about weather the funtion get called or not?
Happy programming.
|
|
|
|
 |
|
 |
I think this issue can simply be solved by usage of a mutex...
with regards,
Manoj G.R.
- "So far so good, but the best is yet to come."
|
|
|
|
 |
|
 |
How to share data between two different processes that are using same DLLs.
I have used
#pragma data_seg("SHARED")
int foo=0;
#pragma data_seg()
#pragma comment(linker, "/section:SHARED,RWS")
But this works for only 1 type of exes (2 EXEs - of same projects.
Any suggestion???
AmolM
|
|
|
|
 |
|
 |
Have you found the answer for that?
HR
|
|
|
|
 |
|
 |
Is it possible by #pragma data_seg("") like or any other way to share the file ?
and Is there any way to share a data( other than #pragma data_seg(""))
Regards,
Rammy.
|
|
|
|
 |
|
 |
i want to share data between some processes. my data is structured and have pointers. please help me as soon as posible!
thanks for help from every one.
|
|
|
|
 |
|
 |
and sencond time,get a kernel error again!
can anybody explain it?
|
|
|
|
 |
|
 |
I have a slightly differnet case to deal with. I am running a DLL as main application (since it is loaded by JNI), and the application will load another DLL. Basically, they are different DLLs working in the same process. However, they share some same data structure. The thing I would like to do is to share some of static/global variables, which come from the same LIB file.
Does anyone know how to fulfill that? I tried the data segment but it seems not working . I have put the #pragma statement in my source for LIB file. It compiles and links well, but still, the data are not shared.
Thanks a lot.
|
|
|
|
 |
|
 |
You have to export it from one DLL, and import it from another. Maybe you put it in a "micro DLL" just for that.
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
 |
|
 |
Hi,
I'm writing a dll which access a com port and will send and rec data from this comport to another device.
This Dll will be loaded by 2 different ocx to access the device.
I tried using 2 different application to access this dll concurrently but only the first application is able to send data through the com port.
I've tried to put the my serial Class in the shared data seg as describe here but to no avail.
Could anyone help?
Learner
|
|
|
|
 |
|
 |
See "DuplicateHandle" in the Platform SDK documentation. Handles are not valid across processes.
|
|
|
|
 |
|
 |
Hi Anonymous,
Thanks for the info. Will visit that to read up.
|
|
|
|
 |
|
 |
I have some problem with inpout32.dll
in win32 console application project my code is:
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
/* ----Prototypes of Inp and Outp--- */
void _stdcall Out32(short PortAddress, short data);
/*--------------------------------*/
/*
int main()
{
Out32(888,20);
return 0;
}
but in MFC project ,it error (i use the same code ,except
int out()
{
Out32(888,20);
return 0;
}
Linking...
thulpt1Dlg.obj : error LNK2001: unresolved external symbol "void __stdcall Out32(short,short)" (?Out32@@YGXFF@Z)
Debug/thulpt1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
thulpt1.exe - 2 error(s), 0 warning(s)
how can i solve it ?
please help me
dnqhung
|
|
|
|
 |
|
 |
My understanding is that you should not use #pragma data_seg("SHARED"), if pointers are to be shared in the DLL.
See:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;100634
Since I had to share pointers in my DLL, I used FileMapping with a Mutex to synchronize access. This seems to work, although I am still a bit confused with some of the details.
I would be interested if someone else has used FileMapping/Mutex or other technique to share pointers in a DLL.
Bob
|
|
|
|
 |
|
 |
Im trying to setup a dll that opens files and reads data. The data is then stored in the dll and both plugins and the main program can access the data. Im writing test dlls to test the concept but im having a bit of trouble opening the file from the dll; the open from stdio fails. Any suggustions?
|
|
|
|
 |
|
 |
Are the plugins in a separate process or something? Note that handles are not shared across processes.
|
|
|
|
 |
|
 |
I have this message after exe compilation :
LINK : fatal error LNK1104: cannot open file "..\TestMemorySpace.lib"
what happend?
|
|
|
|
 |
|
 |
The process has worked for but the paths cause problems for people because the directory structure was flattened during editing.
See response "Re:Could not get it to compile" in this thread.
|
|
|
|
 |
|
 |
Hi i have a c dll which is being called by a c exe. MY setting when compiling the debug or release version of this dll are exactly the same. However, my release version works and debug does not I am clueless at the moment. Has nyone out there come across a similar situation ?
Thank u in advance for your help
newbee78
|
|
|
|
 |
|
 |
Hi i have a c dll which is being called by a c exe. MY setting when compiling the debug or release version of this dll are exactly the same. However, my release version works and debug does not I am clueless at the moment. Has nyone out there come across a similar situation ?
newbee78
|
|
|
|
 |
|
 |
Even though I followed your suggestion regarding the structural layout (or relationship) between "TestDLL" and "TestExe", and also which one should be built first, the following is the error message obtained from compiling "TestExe":
Cannot open include file: '..\TestDll\MyClass.h': No such file or directory
The strange thing is, "MyClass.h" does exist. It is right there in the "TestDll" directory, as well as present in the project workspace. So why the compiler is saying it can't find the file, is beyond me; totally beyond me! (Any help you can offer in this regard would be greatly appreciated.)
With regards to this article, I see it as something that could come in very handy and useful in more ways than one, and would very much like to do some experimenting with it to test its limits.
Thank you for sharing it with us.
William
Fortes in fide et opere!
|
|
|
|
 |
|
 |
I just unzipped all files using directories to C:\MyTest.
Then I 'moved' not copied TestExe folder inside TestDll.
At this point I had.
C:\myTest
c:\mytest\TestDll
C:\myTest\testdll\testexe
Then I build the dll, and then the exe.
Next I started two copies of the exe and it seemed to be fine.
statement
#include "..\TestDll\MyClass.h"
is your problem, if you right click on this it should open for you. If it does not rebuild dependencies or edit your directory structure.
|
|
|
|
 |