Top Banner
DotNetConn ect Andreas Tönne, Georg Heeg eK
36

DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Jan 02, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

DotNetConnect

Andreas Tönne, Georg Heeg eK

Page 2: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

OverviewOverview

About

Overview .NET

Demo

Architecture

Limitations

Benchmarks

Conclusions

Page 3: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

About Georg Heeg eKAbout Georg Heeg eK

100% Smalltalk since 1987

Offices in Dortmund

Köthen (Anhalt)

Zürich (CH)

Consulting, Product development

VisualWorks Support EMEA for Cincom

Windows CE platform

Page 4: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Overview of .NET (technical view)Overview of .NET (technical view)

Common language runtime (aka VM) for a family of typed languages

C#

C++

VB

many more

even some Smalltalk dialects

Page 5: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Overview of .NET (technical view)Overview of .NET (technical view)

Huge, ever growing libraries that eventually will cover all of Windows and more

Web services

ASP. Net

Longhorn, Visual Studio ...

Successor to COM/COM+/ActiveX

Page 6: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Overview of .NET (management view)Overview of .NET (management view)

The future platform for application development

Will replace everything else in 10 years

Seriously reduced costs in development and maintainace

Platform for web services

Page 7: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Demo ScenarioDemo Scenario

Existing Smalltalk applicationDemo: engineering domain/measuring tool

Need to interface to .NET-componentsNew hardware with new drivers

Replacement for COM-components

Someone listened to Microsoft marketing

How do we keep our investment in Smalltalk alive?

Page 8: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Live DemoLive Demo

1. Smalltalk and C#-Applications

2. Installation DotNetConnect

3. Running the wizard

4. OutputCompile, link and file in

5. The missing link

6. Application test

Page 9: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Live Demo Step #1Live Demo Step #1

Smalltalk application shows graphical transcript of points received in real-time

C# application publishes event carrying a Pointpublic delegate void PointEventHandler(object sender, PointEventArgs e);

public event PointEventHandler Coordinate;

Event created by moving the mouse

Page 10: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Live Demo Step #2Live Demo Step #2

Install DotNetConnectPoint to VM-bin directory for finding DLLs

Directories for generated code side-by-side with the image

Two flavors: runtime and wizard

Page 11: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Live Demo Step #3Live Demo Step #3

Running the wizard

A) Settings:Load the desired assembly

Adjust target package ‚from assembly‘

B) Check Types:Inspect not-importable types

Luckily we have none

(optional) will be run anyways

Page 12: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Live Demo Step #3Live Demo Step #3

C) Review kept/deleted codeoptional

D) Generate Code

Wizard finished

Page 13: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Live Demo Step #4Live Demo Step #4

Output (Sources-DLL):EventDemoProxy.mak

EventDemoProxy_class.h/cpp (managed)

EventDemoProxy_dll.h/cpp (unmanaged)

EventDemoProxy_eventClass.h

nmake EventDemoProxy.mak

copy EventDemoProxy.dll to VM directory

Page 14: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Live Demo Step #4Live Demo Step #4

Output (Sources-VW):EventDemoProxy_namespace.st

EventDemoProxy_ext_interface.stExternalInterface for EventDemoProxy.dll

EventDemoProxy_ext_stub.stWrapper for external interface with marshalling

EventDemoProxy_domain_stub.stObject-mapper for the wrapper for the external interface to the DLL

File In the sources...

Page 15: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Live Demo Step #5Live Demo Step #5

Hook the Smalltalk application to the EventDemo application

| dotNetInstance |

dotNetInstance := DotNET.Heeg.EventDemo New.

[DotNET.Heeg.EventDemo Main: dotNetInstance] forkAt: 51.

dotNetInstance upon: #EventDemoCoordinate send: #newSample:with: to: self

newSample: sender with: coordinate| dotNetPoint |

dotNetPoint := coordinate GetPoint.

currentSample := dotNetPoint X @ dotNetPoint Y

Page 16: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Live Demo Step #6Live Demo Step #6

Page 17: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Architecture - ChoicesArchitecture - Choices

Expensive:Web services

Intrusive:Corba

COM

Direct:Custom marshalling

Communication via TCP or C-calls

Proxy in .NET-world

There is no call-in interface in .NET!

Page 18: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Architecture - DotNetConnectArchitecture - DotNetConnect

EventDemo ExternalInterface

VW Managed .NET

EventDemo

EventDemo Stub

EventDemo

EventDemo Proxy DLL

Unmanaged .NET

Page 19: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Architecture - DotNetConnectArchitecture - DotNetConnect

Direct communication

Marshalling for all primitive data types, values and objects

Proxy is C-DLL with one end in the managed .NET-world

No reflection at runtime -> fast

Bridging the world delegated to the Microsoft C++-Compiler

Page 20: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Architecture – Call sequenceArchitecture – Call sequence

EventDemo ExternalInterface

VW Managed .NET

EventDemo

EventDemo Stub

EventDemo

EventDemo Proxy DLL

Unmanaged .NET

Page 21: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Code-ExamplesCode-Examples

EventDemo method invocationDotNET.Heeg.EventDemo Main: eventDemoInstance

Main: instance

EventDemoStub current Static_EventDemo_Main: instance objectId

EventDemoStub marshalling etc.Static_EventDemo_Main: instance

| errorCode instancePointer |

instancePointer := instance gcCopyToHeapUnicode.

errorCode := self externalInterface Static_EventDemo_Main: instancePointer.

self checkError: errorCode.

Page 22: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Architecture – Call sequenceArchitecture – Call sequence

EventDemo ExternalInterface

VW Managed .NET

EventDemo

EventDemo Stub

EventDemo

EventDemo Proxy DLL

Unmanaged .NET

Page 23: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Code-ExamplesCode-Examples

Call-out in EventDemoExternalInterfaceStatic_EventDemo_Main: instance

<C: int _threaded Static_EventDemo_Main(wchar_t* instance)>

^self externalAccessFailedWith: _errorCode

Call-in in EventDemoProxy.dll// Static System.Void Main (Heeg.EventDemo instance)

__declspec(dllexport) int Static_EventDemo_Main(wchar_t* instance)

{

reset_error();

return theProxy.Static_EventDemo_Main(instance);

}

Page 24: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Architecture – Call sequenceArchitecture – Call sequence

EventDemo ExternalInterface

VW Managed .NET

EventDemo

EventDemo Stub

EventDemo

EventDemo Proxy DLL

Unmanaged .NET

Page 25: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Code-ExamplesCode-Examples

Step into the managed .NET Worldint EventDemoProxy::Static_EventDemo_Main(wchar_t* instance)

{

int error_code = 0;

try

{

Object* raw1 = this->DeReferenceObject(instance);

Heeg::EventDemo* arg1 = __try_cast<Heeg::EventDemo*>(raw1);

Heeg::EventDemo::Main(arg1);

}

catch(Exception* ex)

{

....

Page 26: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Architecture – Call sequenceArchitecture – Call sequence

EventDemo ExternalInterface

VW Managed .NET

EventDemo

EventDemo Stub

EventDemo

EventDemo Proxy DLL

Unmanaged .NET

Page 27: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Code-ExamplesCode-Examples

The C# application[STAThread]

static public void Main(EventDemo instance)

{

Application.Run(instance);

}

Everything but this C# application is generated by the wizard!

C++ and VW 7 code

Page 28: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

LimitationsLimitations

.NET-CLR is a superset of C# or C++

Not all legal types are importable because the DLL cannot be compiled

Some illegal types are detected

Some illegal types lead to compile errors

Members with overloaded signatures need manual case statement in Smalltalk

Page 29: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

DetectedDetected

Value types without GetHashCode()

all sorts of unmanaged pointers

Multi-dimensional arrays and arrays of arrays

Visibility constraints of class types

Reserved words as parameter names

Events must have void return type and two parameters

Page 30: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Undetected, UnsupportedUndetected, Unsupported

Multi-dimensional arrays or arrays of arrays used as member fields

Multi-dimensional indexerAmbiguity of [x,y] and [x][y] unresolved

Delegates with Array parameters

Member that are inherited from multiple interfaces

Inherited from interface and overloaded

Ambiguity of short and wchar_t

Page 31: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Manual CorrectionsManual Corrections

Overloaded .NET MemberE.g.. Class System.Collections.Queue constructor

1. Queue (System.Collections.ICollection col)

2. Queue (System.Int32 capacity)

Needs manually written case statement in Smalltalk-method

Page 32: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

BenchmarksBenchmarks

Measured on 1140MHz, 256MB AthlonMethod invocation: 0,7 µS

Scalar parameter: not measurable

n reference parameters: 6+16n µS

n type Object parameters: 17+22n µS

Return valuesScalar: 19 µS

Reference: 61 µS

Type Object: 87 µS

Instance creation: 130 µS

Further optimizations pending

Page 33: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

ConclusionsConclusions

Automated generation of .NET-interface

Wizard-driven with manual control

‚No brainer‘ in almost all cases

No C++ knowledge necessaryunless hit by type limitations

Fast

Page 34: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Future DevelopmentFuture Development

Next major step: DotNetConnect becomes NConnect

100% integrated in Visual Studio

Project-Wizard generated Solution

.NET-GUI inside VisualWorks

Page 35: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

Georg Heeg eKBaroper Str. 337D-44227 DortmundTel: +49-231-97599-0Fax: +49-231-97599-20

Email: [email protected]://www.heeg.de

Georg Heeg AGRiedtlistr. 8

CH-8006 ZürichTel: +41-1-356 3311Fax: +41-1-356 3312

Georg Heeg eKMühlenstr. 19

D-06366 KöthenTel: +49-3496-214 328Fax: +49-3496-214 712

Page 36: DotNetConnect Andreas Tönne, Georg Heeg eK. Overview About Overview.NET Demo Architecture Limitations Benchmarks Conclusions.

2004 Cincom Systems, Inc. All Rights Reserved

Developed in the U.S.A.CINCOM, , and The World’s Most Experienced Software Company are trademarks or registered trademarks

of Cincom Systems, Inc

All other trademarks belong to their respective companies.