I am trying hub4com for my own project to see how it works and I got this weird problem:
1. I compiled the application with VC++ for Win32 XP and run it as hub4com.exe, everything worked correctly. I was able to connect 2 com ports to 1. My command line wss as follows.
In this case I could read/write from COM3 to COM5 but not COM6. If I switched the positions of COM5 and COM6 in the command line, then I could read/write from COM3 from/to COM6 but not COM5.
Anyone knows why the difference between the .exe and the DLL? Help please.
PS: I just add the follwing lines to run hub4com as DLL. The rest was not touched.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2012-06-21
Hi,
Thanks for release of this wonderful program.
I'm also trying to convert this program into DLL, and calling the DLL from a program that is written with C# using using P/Invoke.
but I'm facing some problems to properly release and unload the DLL, for example close the COM Ports, Close the connections, properly release the plugins etc. I can only do that by restarting the program… That's where I realized that I should learn more about programming…
Is there a way to properly shut all the connections without having the program restarted?
Thanks a lot!
Juan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am trying hub4com for my own project to see how it works and I got this weird problem:
1. I compiled the application with VC++ for Win32 XP and run it as hub4com.exe, everything worked correctly. I was able to connect 2 com ports to 1. My command line wss as follows.
>hub4com.exe --bi-route=All:All --baud=38400 \\.\COM3 --baud=38400 \\.\COM5 \\.\COM6
All bytes are transmitted correct to/from COM3 from/to COM5 and COM6.
2. But when I tried to run the same code as DLL. Only and always the 1st port behaved correctly.
>RunDll32 hub4com,RunMain --bi-route=All:All --baud=38400 \\.\COM3 --baud=38400 \\.\COM5 \\.\COM6
In this case I could read/write from COM3 to COM5 but not COM6. If I switched the positions of COM5 and COM6 in the command line, then I could read/write from COM3 from/to COM6 but not COM5.
Anyone knows why the difference between the .exe and the DLL? Help please.
PS: I just add the follwing lines to run hub4com as DLL. The rest was not touched.
///////////////////////////////////////////////////////////////
#pragma comment(linker, "/EXPORT:RunMain@1=RunMain")
void CALLBACK RunMain
(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
{
int argc = 0;
char * argv[10];
char * pch;
pch = strtok (lpszCmdLine, " ,");
while (pch != NULL)
{
cout << pch << endl;
argv[argc] = strdup(pch);
argc++;
pch = strtok (NULL, " ,");
}
main(argc, (char **)argv);
}
>RunDll32 hub4com,RunMain --bi-route=All:All ...
The argv[0] is a program path. Fix RunMain or use
RunDll32 hub4com,RunMain hub4com --bi-route=All:All ...
Hi,
Thanks for release of this wonderful program.
I'm also trying to convert this program into DLL, and calling the DLL from a program that is written with C# using using P/Invoke.
but I'm facing some problems to properly release and unload the DLL, for example close the COM Ports, Close the connections, properly release the plugins etc. I can only do that by restarting the program… That's where I realized that I should learn more about programming…
Is there a way to properly shut all the connections without having the program restarted?
Thanks a lot!
Juan