Hi Sam,
Don't those methods allow you to keep your application completely separate from our KMotion Folders?
Regards TK
Group: DynoMotion |
Message: 9643 |
From: Sam Marrocco |
Date: 6/9/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
On 6/9/2014 6:22 PM, Tom Kerekes
tk@... [DynoMotion] wrote:
Hi Sam,
Don't those methods allow you to keep your application completely separate from our KMotion Folders?
Yes, but properly sandboxing my application requires that it's debug/release folders contain *everything* necessary to run. This eliminates many of the issues around potential DLL Hell (placing my/your DLLs into the system's DLL folder) and the danger of "everything
is sandboxed except someone elses DLLs" which can break my application if something updates their DLLs/dependencies that my application references from another location. This never includes some system related libraries or the dotnet framework.
By placing any DLL (or other material) referenced by my application or it's children into my application's folder and referencing it from there it is isolated from any (within reason) changes made to the system involving anything other me updating my app.
...I think that made sense :)
A prime example of why this would be a bad idea for most applications: Someone writes an app and places its executables, references, setups, preferences into your KMotion folder hierarchy. A year later upon finding a bug (not that that ever happens) KMotion432
is removed from the machine and KMotion433 is installed. Oops--those custom written executables may now be lost, and someone has to remember everything that was referenceing KMotion432 and redirect everything to the new KMotion433. In all of these example,
any changes made to KMotion_VersionNumber affects all the applications that were in or referencing that folder....and you may not want the app to reference the new version for some reason, but can by copying the new DLL into the sandbox if needed, usually
with no recompilation needed.
An overlooked plus of this method is that an application can be added/installed/updated on a machine by dragging a folder from one machine to another (albeit not including lower level device drivers and such).
sam marrocco | chief technical officer
ringside.cutters.picnic.moonlink
248 548 2500 w
248 910 3344 c
ringsidecreative.com
|
|
Group: DynoMotion |
Message: 9644 |
From: Sam Marrocco |
Date: 6/9/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
Since I wish to keep my application sandboxed and apart from the KMotion folders entirely, is the only way of determining what KMotion_dotnet references by trial and error, i.e. copying over the contents of KMotion then deleting one file at a time to determine
what fails when it is removed?
Okay, a lot of trial and error later trying various dependencies and I've come to the following conclusion...
Referencing KMotion_dotnet.dll within a vb.net application to utilize the KM_Controller, KM_CoordMotion and KM_Interpreter classes requires the additional presence (un-referenced) of the following Dynomotion DLLs:
GCodeInterpreter.dll
KMotion_dotNet_Interop.dll
KMotionDLL.dll
KMotionServer.exe
If these three additional DLLs and one executable are in the same folder as the KMotion_dotNet.dll referenced by a dotnet application, everything appears to run correctly. I have not heavily tested this yet but several KMotion_dotnet related function calls
now appear to be working including board inquiries.
sam marrocco | chief technical officer
ringside.cutters.picnic.moonlink
248 548 2500 w
248 910 3344 c
ringsidecreative.com
|
|
Group: DynoMotion |
Message: 9645 |
From: Tom Kerekes |
Date: 6/9/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
Hi Sam, To execute C programs in KFLOP your app may also need the TCC67.exe compiler and the header files and DSPKFLOP.out file in the DSP_KFLOP Directory. Regards TK
Group: DynoMotion |
Message: 9646 |
From: Sam Marrocco |
Date: 6/10/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
On 6/9/2014 9:43 PM, Tom Kerekes
tk@... [DynoMotion] wrote:
Hi Sam,
To execute C programs in KFLOP your app may also need the TCC67.exe compiler and the header files and DSPKFLOP.out file in the DSP_KFLOP Directory.
Understood.
Here's a strange issue that has popped up:
I moved the SimpleFormsCS.exe app (since it was a good example of a compile/download app) into a folder named "Debug" on my desktop (since that is by default the foldername VisualStudio creates for an application. I then copied into that folder the current
list of perequisites we've been building....currently
KMotion_dotNet.dll
GCodeInterpreter.dll
KMotion_dotNet_Interop.dll
KMotionDLL.dll
KMotionServer.exe
TCC67.exe
TCC67.ilk
DSP_KFLOP (Folder with it's 4 files)
Running SimpleFormsCS.exe results in a dialog box with the error:
"Error Extracting Version Information from file
c:\Users\root\Desktop\Test2\Bin\DSP_KFlop\DSPKFlop.out"
NOTE: The actual path of the test is:
C:\Users\root\Desktop\Test2\Bin\Debug
If I rename the Debug Folder to be *anything other than Debug* the simpleFormsCS.exe will run fine.
If the folder is named "Debug" it fails with that error and looks at the parent folder of the executable to find the DSP_Flop folder. It does not exhibit this behavior when the folder is named something else.
sam marrocco | chief technical officer
ringside.cutters.picnic.moonlink
248 548 2500 w
248 910 3344 c
ringsidecreative.com
|
|
Group: DynoMotion |
Message: 9647 |
From: Tom Kerekes |
Date: 6/10/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
Hi Sam,
The libraries are written to expect the directory structure that is installed. The KMotionDLL.dll is normally at:
<Install
dir>\KMotion\Debug\KMotionDLL.dll
The DSPKFLOP.out file is at
<Install dir>\DSP_KFLOP\DSPKFLOP.out In this case KMotionDLL walks up fromits location a Debug (or Release) directory to find a "MainPath" = <Install dir>\KMotion
From there it walks up the KMotion directory to find a "MainPathRoot" = <Install dir>
To do the DSP Code binding it then performs:
if
(BoardType == BOARD_TYPE_KMOTION) BindTo = MainPathRoot + "\\DSP_KMotion\\DSPKMotion.out"; else BindTo = MainPathRoot + "\\DSP_KFLOP\\DSPKFLOP.out";
With your modifications it is only able to locate the Debug directory or nothing, so the MainPathRoot is set correspondingly.
If you wish to examine or change the code, search for MainPathRoot under KMotionDLL
Regards TK
Group: DynoMotion |
Message: 9648 |
From: Sam Marrocco |
Date: 6/10/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
On 6/10/2014 6:23 PM, Tom Kerekes
tk@... [DynoMotion] wrote:
Hi Sam,
The libraries are written to expect the directory structure that is installed. The KMotionDLL.dll is normally at:
<Install dir>\KMotion\Debug\KMotionDLL.dll
The DSPKFLOP.out file is at
<Install dir>\DSP_KFLOP\DSPKFLOP.out
In this case KMotionDLL walks up fromits location a Debug (or Release) directory to find a "MainPath" = <Install dir>\KMotion
From there it walks up the KMotion directory to find a "MainPathRoot" =
<Install dir>
To do the DSP Code binding it then performs:
if (BoardType == BOARD_TYPE_KMOTION)
BindTo = MainPathRoot + "\\DSP_KMotion\\DSPKMotion.out";
else
BindTo = MainPathRoot + "\\DSP_KFLOP\\DSPKFLOP.out";
With your modifications it is only able to locate the Debug directory or nothing, so the MainPathRoot is set correspondingly.
If you wish to examine or change the code, search for MainPathRoot under KMotionDLL
Got it.
Changing your code would result in a fork that I would rather not have or maintain. It would force me to alter your code and recompile it anytime you released an update.
I know I'm using a KFlop board and the DSP_KFLOP libraries/folder are needed for downloading C apps to the board. What is the DSP_KMOTION folder? Is it required for what we've been discussing or is it only a prerequisite for the library builds?
sam marrocco | chief technical officer
ringside.cutters.picnic.moonlink
248 548 2500 w
248 910 3344 c
ringsidecreative.com
|
|
Group: DynoMotion |
Message: 9649 |
From: Tom Kerekes |
Date: 6/10/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
Hi Sam,
In Your case you only have a KFLOP Board and only the DSP_KFLOP folder is required. Other Controller Board Types would have other folders. We currently only support KFLOP boards.
Regards TK
Group: DynoMotion |
Message: 9650 |
From: Sam Marrocco |
Date: 6/10/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
On 6/10/2014 7:26 PM, Tom Kerekes
tk@... [DynoMotion] wrote:
Hi Sam,
In Your case you only have a KFLOP Board and only the DSP_KFLOP folder is required. Other Controller Board Types would have other folders. We currently only support KFLOP boards.
The cleanest way of sandboxing a KFlop DotNet application seems to be this:
1-Create a new DotNet Solution/Project and set the Project/Properties for the following
Set the Debug Configuration's Build output path = bin\Debug1 (This can be anything except a folder named "Debug" or "Release")
Set the Release Configuration's Build output path = bin\Release1 (This can be anything except a folder named "Debug" or "Release")
2-Into your newly created Debug1 or Release1 folder(s), copy the appropriate debug or release versions of the following from the KMotion/Debug|Release folder:
KMotionDLL.dll
KMotion_dotNet.dll
KMotion_dotNet_Interop.dll
GCodeInterpreter.dll
KMotionServer.exe
TCC67.exe
3-Copy the folder DSP_KFLOP and it's contents into both the Debug1 and Release1 folders.
Why it works: By using names other than "Debug" and "Release" for the application container folders we prevent the KMotionDLL from looking for a parent folder containing the KFLOP headers and compiles. This causes KMotionDLL to look in the current apppath (which
happens to be where everything else is as well) for the DSP_KFLOP folder.
At any point in the future, the Debug1 or Release1 container folders can be renamed with their app's name (or anything else other than the words Debug or Release) and moved, copied and the dotnet application within should continue to run without issue.
sam marrocco | chief technical officer
ringside.cutters.picnic.moonlink
248 548 2500 w
248 910 3344 c
ringsidecreative.com
|
|
Group: DynoMotion |
Message: 10572 |
From: Sam Marrocco |
Date: 11/26/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
Thanks for the very detailed explanation... It seems to solve the issue... :)
Glad it helped....Even when we all write code in the same language sometimes it helps to have a translator :)
Anything I can do to help, feel free to ask.
sam marrocco | chief technical officer
ringside.cutters.picnic.moonlink
248 548 2500 w
248 910 3344 c
ringsidecreative.com
|
|
Group: DynoMotion |
Message: 10573 |
From: geraldft |
Date: 11/26/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
Hi Well a little premature. The test program runs but won't connect to kflop.. :(
What I actually did was create a new windows forms project and copied the code from the vb example. Then in the release and debug folders copied the 6 files you indicated. I tried making debug1 and release 1 folders but it seemed to insist on still using the std debug and release folders for some reason.
When I run the program there are no errors but also no connection to kflop... any clues or things to check?
BTW I am using an older version of kflop firmware, though this did still connect with the original compile which was made in the build examples version...
Thanks Gerald
|
|
Group: DynoMotion |
Message: 10574 |
From: Tom Kerekes |
Date: 11/26/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
Hi Gerald,
I can't think of a reason the code would run but not "connect". Hard to say without more details. What do you mean "won't connect". What is the app doing to try to connect? The simplest thing might be to step into the code and see what is happening and going wrong.
Also check if KMotion.exe is able to connect.
Maybe target the app into our normal Release directory and see if it is able to connect.
Regards TK
Group: DynoMotion |
Message: 10575 |
From: geraldft |
Date: 11/26/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
Thanks. By connect I mean connect to Kflop and make axes respond when jogging.
The interface is there but no readouts for motor position.
The version I compiled earlier using "build all" does connect, but when compiled from an independent project as described it doesn't connect to kflop. It also reports no errors.
Any particular lines of code I should check? THanks G
|
|
Group: DynoMotion |
Message: 10576 |
From: geraldft |
Date: 11/26/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
Ah ha... I found the problem. Timer1 was not running... oops. Looks like the handles timer1.tick got deleted by VS when I copied the code... Thanks for your concern. Now I can move on..
Gerald
|
|
Group: DynoMotion |
Message: 10577 |
From: Sam Marrocco |
Date: 11/26/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
What I actually did was create a new windows forms project and copied the code from the vb example. Then in the release and debug folders copied the 6 files you indicated. I tried making debug1 and release 1 folders but it seemed to insist on still using
the std debug and release folders for some reason.
To quote Mae West--"I never said it would be easy, I only said it would be worth it."
I'll suggest you first update everything to the newest release version of the KFlop stuff.
Next, you cannot manually create the debug1/release1 folders. They must be setup in your VS project settings or it won't know the folder in which to compile.
Steps to setup your VS.Net project:
1-Create a new DotNet Solution/Project and set the Project/Properties to the following-
Set the Debug Configuration's Build output path to bin\Debug1 (This can be anything except a folder named "Debug" or "Release")
Set the Release Configuration's Build output path to bin\Release1 (This can be anything except a folder named "Debug" or "Release")
2-Into your project's newly setup Debug1 or Release1 folder(s), copy the appropriate debug or release versions of the following files from the KMotion/Debug|Release folder:
KMotionDLL.dll
KMotion_dotNet.dll
KMotion_dotNet_Interop.dll
GCodeInterpreter.dll
KMotionServer.exe
TCC67.exe (This is the compiler for their DSP C code)
emc.var (This is required at initialization of the Interpreter code (for using GCode). The interpreter can be set to go to another file AFTER this one is read by default, even if you don't want to use it, but it MUST be present at Interpreter Initialization.
3-Copy the folder DSP_KFLOP and it's contents from C:\KMotion<Version> into both the Debug1 and Release1 folders (if both are to be used).
This cures an issue created in the folder hierarchies that Dynomotion has set up that follows the following rule:
-If the Executable's containing (parent) folder is named Debug or Release, the Dynomotion's libraries look for the folder named DSP_KFLOP in the parent folder's path.
-If the Executable's containing (parent) folder is NOT named Debug or Release, the Dynomotion's libraries look for that folder in the same folder as the executable.
Why my setup works: By using names other than "Debug" and "Release" for the application container folders we prevent the KMotionDLL from looking for a parent folder containing the KFLOP headers and compiles. This causes KMotionDLL to look in the current app
path (which happens to be where everything else is as well) for the DSP_KFLOP folder.
At any point in the future, the Debug1 or Release1 container folders can be renamed with their app's name (or anything else other than the words Debug or Release) and moved, copied and the dotnet application within should continue to run without issue.
sam marrocco | chief technical officer
ringside.cutters.picnic.moonlink
248 548 2500 w
248 910 3344 c
ringsidecreative.com
|
|
Group: DynoMotion |
Message: 10578 |
From: geraldft |
Date: 11/26/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
HI It is sorted now since fixing timer bungle.
I manually created the alternative build folder then assigned it via "build output path" option. Actually now I have reverted and just use the bin\debug folder again and it still works ok. So renaming these doesn't seem necessary...
I also confirmed it wasn't trying to go back and use the Kmotion program folder files, by making them offline temporarily. So a fresh start with just the 6 files and dspkflop folder. Though the test program is not actually using this so far - I guess it's only used if new c-code needs to be compiled and uploaded?
Thanks Gerald
|
|
Group: DynoMotion |
Message: 10579 |
From: Sam Marrocco |
Date: 11/26/2014 |
Subject: Re: KFlop and dotnet dependencies.... |
I also confirmed it wasn't trying to go back and use the Kmotion program folder files, by making them offline temporarily. So a fresh start with just the 6 files and dspkflop folder. Though the test program is not actually using this so far - I guess it's
only used if new c-code needs to be compiled and uploaded?
Yes....not all files are required for basic code. But, you'll soon find yourself encountering errors as you begin doing things such as using the interpreter, compiling startup configuration code (as you thought) and adding features. I found it handy to individually
remove files one at a time to determine what individual functions they brought to the party.
sam marrocco | chief technical officer
ringside.cutters.picnic.moonlink
248 548 2500 w
248 910 3344 c
ringsidecreative.com
|
|
| | | | | | | | | |