Book a Demo

Author Topic: Import by disasembly or reflecting?  (Read 3806 times)

Martin Terreni

  • EA User
  • **
  • Posts: 672
  • Karma: +0/-0
  • Sorry, I can't write
    • View Profile
Import by disasembly or reflecting?
« on: January 17, 2007, 03:11:21 am »
Binary import by disasembly or reflecting?
What's the diference?
Recursion definition:
If you don’t understand the definition read "Recursion definition".

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Import by disasembly or reflecting?
« Reply #1 on: January 17, 2007, 05:58:06 am »
Just two different approaches, both of which could be viable for both Java and .Net.

Back some time there were problems importing some .Net libraries with one of the methods (I don't remember which, but it was the default at the time). The other method worked, so all was well. I reported at least one bug related to this, Sparx repaired this in the following build, and we verified that it worked.

So, for now you can probably use either for 'system' stuff, and keep the other method as a workaround.

If you receive a library from a third party you might only be able to use one of the methods. Perhaps the code has be obfuscated (there are tools that do this to protect source from disassembly). In that case you can use the reflection method to read the accompanying manifest and create a structural model.
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Import by disasembly or reflecting?
« Reply #2 on: January 17, 2007, 02:02:24 pm »
Basically the two different methods were provided for .Net because there are some issues with each of them.  (For example reflection requires all dependant libraries to be available)

Martin Terreni

  • EA User
  • **
  • Posts: 672
  • Karma: +0/-0
  • Sorry, I can't write
    • View Profile
Re: Import by disasembly or reflecting?
« Reply #3 on: January 18, 2007, 03:38:45 am »
but what's the diference? ???
Recursion definition:
If you don’t understand the definition read "Recursion definition".

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Import by disasembly or reflecting?
« Reply #4 on: January 18, 2007, 05:05:37 am »
Perhaps...

Reflection might be preferable, particularly where code has been obfuscated - perhaps in a commercial product. This is how both Java and .Net prefer to discover information about libraries during design and at run time.

However, as Simon points out, this method depends on all libraries being present. There could be other issues, for example where hidden methods exist, and could be important to the model.

Disassembly might overcome the above limitations, but has additional costs, in both time and complexity. I'm guessing, but there could also be 'clutter' if there were a lot of internal plumbing in the libraries.

Sparx has provided us with two approaches. Most of the time, if you've got the entire library set available, these will produce the same results - try importing the entire .Net or Java library set both ways and compare.

So, try the default that EA offers. If you don't get the result you want, use the other setting.

[Sparxians: hopefully I'm not too far off. Please correct me if I've misstated your case.]

HTH, David
No, you can't have it!

Martin Terreni

  • EA User
  • **
  • Posts: 672
  • Karma: +0/-0
  • Sorry, I can't write
    • View Profile
Re: Import by disasembly or reflecting?
« Reply #5 on: January 18, 2007, 05:59:55 am »
Thanks , that's a much better explenation (now I know wich one I should prefer and why)
Though I think I was asking the wrong question, what I wanted to ask is: what is the difernce in the algorithm? how do they work?

Recursion definition:
If you don’t understand the definition read "Recursion definition".

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Import by disasembly or reflecting?
« Reply #6 on: January 18, 2007, 01:06:54 pm »
Dissasembly calls ILDasm.exe from your .Net install to produce the IL code for your model.

Reflection calls one of the AsmImporter executables in your EA install directory to query the assembly and produce a C# representation.

EA then parses whichever of these you have generated.  That's about all I can say on the difference (and what you could find out for yourself by looking at the EA output window.)

Martin Terreni

  • EA User
  • **
  • Posts: 672
  • Karma: +0/-0
  • Sorry, I can't write
    • View Profile
Re: Import by disasembly or reflecting?
« Reply #7 on: January 18, 2007, 10:42:40 pm »
thanks!
Recursion definition:
If you don’t understand the definition read "Recursion definition".