|
I am trying to allow a cold fusion app to use a dll. I do not know cold fusion but they say that they use a tag to grab the dll and send it a parameter. It does not call an API function in the dll but rather calls the dll with a parameter. If i create a win 32 dll , can i just put my code in here:
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
Oh maybe not cause this returns bool.
I think it has to be a dll with a "main" section. Any input?
|
|
|
|
|
Hi friends,
I'm trying to forward a TCP/IP port (can be described dynamic) to MySQL port (3306).
Although i've written an MFC project using CASyncSocket to solve this problem. It works with Client/Server text communication based programs but it cannot fwd MySQL requests.
-Let me tell what i did:
1.Listen a port
2.Accept incoming connection (this is the incoming socket)
(for this accepted socket)
I.If receive any data Read max 100 byte packet
II. Add this packet to an array (vector)
III. A thread (consumer thread) checks this array's size
-if there's any packet sends it to 3306 by another CAsyncSocket
object (this is the outgoing socket)
IV. Same process for incoming data from 3306 to accepted socket
i wrote another Client/Server application which only acceps incoming requests and read their messages and echo it to themselves. This is a text based communication.
Result:
forwarder can't forward the data between app and MySQL host
i think main goal is binary data!
how can i do this
Could anyone help me?
Thanks lot,
|
|
|
|
|
I'm lost. Which part isn't working?
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
-in project: every time i Receive static sized byte array from incoming socket
then send it to server (with the length of received size)
it only works with text based communication like chat
but mysql send binary data (and uses its' own protocol)
may be..., could you tell about the logical analyse or steps (like overflow diagram) about how to forward an incoming TCP/IP connection to another host:Port
like Proxy's but independent from connection protocol (like physical bridges used to separate sub networks)
thanx a lot for your reply
Note: i must go out coz it's late
|
|
|
|
|
What about data coming FROM the server to the client? Are you relaying all that data too?
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Yes, i do reply, when i receive any message from one of them i put it into related queue then forward it
i don't know much about MySQL server communication protocol may it be related with this?
i only want to send all packages from one gate to another gate (and reverse) that's all
|
|
|
|
|
I see you've closed the project but if you were looking at "messages" as they passed through
then you'd need to know everything about the message protocol. Otherwise every byte should
be passed through untouched.
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
We've closed this project coz it's much complex for a single project's single leaf
we've agreed to use a PROXY server to solve this problem
|
|
|
|
|
I've created a static global variable, "static int m_foo", in stdafx.h in my MFC project.
Then I change the value of m_foo in the FooMainFrm.cpp file.
Whenever I query m_foo, in any of the other modules, I find its state reinitialized to zero.
Using the "extern" keyword at the top of each of the modules doesn't help.
What's going on here?
|
|
|
|
|
werpa wrote: Using the "extern" keyword at the top of each of the modules doesn't help
did put the extern keyword on every cpp files that use it, or all but one ?
anyway, global variables don't need to be static AFAIK.
and at last, why going global ? can't you incorporate your variable as a class member (public static if you like) ?
|
|
|
|
|
I put "extern" in the modules that used the varialbes. I didn't put it in the ones that didn't use the variable. I am incorporating the variable into a class where it doesn't precisely fit in order to have its global and static reach.
|
|
|
|
|
werpa wrote: I am incorporating the variable into a class where it doesn't precisely fit in order to have its global and static reach.
Sounds like it might belong in your CWinApp -derived class.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Assuming that static specifies that m_foo is not visible from outside stdafx.h , what if you remove the static qualifier?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I need to make it "static" in order to keep from getting fatal LNK1169 error "one or more multiply defined symbols found"
|
|
|
|
|
werpa wrote: error "one or more multiply defined symbols found"
this is normally solved using extern, not static, no ?
my bad, David got it right. you must use exclusive statement macros
|
|
|
|
|
werpa wrote: I need to make it "static" in order to keep from getting fatal LNK1169 error "one or more multiply defined symbols found"
Something is amiss with your stdafx.h file. It should resemble:
#if !defined(STDAFX_H)
#define AFX_STDAFX_H
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define _WIN32_WINNT 0x0500
int m_foo;
#endif
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thanks for your good thoughts.
I made these changes but still need "static" to keep from getting LNK1169.
|
|
|
|
|
werpa wrote: I made these changes but still need "static" to keep from getting LNK1169.
You are simply addressing the symptom and not the underlying cause. Find all declarations of m_foo . The one in stdafx.h should be declared as:
int m_foo; and all others should be declared as:
extern int m_foo; You'll find that Nemanja's suggestion is a bit cleaner, though, as it only requires changing two files.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
That worked great to get rid of the LNK1169. (I put it the extern everywhere!) Now, however, it comes back if I set the value or query it. As long as I don't use the value in the module the error stays away. The minute I add it to the module, I get it back.
|
|
|
|
|
Isn't that reversed?
Shouldn't the extern declaration be in the header and ONE "int m_foo;" instance be in a cpp
module somewhere?
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
nope.
by doing what Nemanja suggested, every cpp file actually includes the extern declaration (so, don't define the variable, and assume that it is defined elsewhere), and stdafx.cpp is the exception, by actually declaring the global variable.
oh my !
forget it
|
|
|
|
|
Goofball
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
I tried it both ways and it worked the same. Since the header file looked like this, the variable was only declared once.
Like I said, Nemanja's way is cleaner as it only involves two changes, rather than multiple changes depending on how many places use the "global" variable.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
OK I assumed stdafx was used in the normal way - as a PCH included in every module. Which
would make a separate instance for every module, right?
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
This will produce link errors because every .CPP file will have a definition of the variable m_foo .
Steve
|
|
|
|