Click here to Skip to main content
13,093,720 members (60,392 online)
Rate this:
Please Sign up or sign in to vote.
We have an old VSE Smalltalk application and we want to be able to call a c# webservice that will return a string.

I have been unable to get any call to a managed dll working from Smalltalk but I have been able to create a c++ win32 dll that can be called from Smalltalk, which in turn can call c# managed code.

Does anyone know of any other options for getting the c# call working directly without going through the c++ (eg ways to build the dll?). We are running into issues mapping strings with our limited c++ knowledge and would really like to bypass this layer if possible.

Note the smalltalk app is a standalone app (exe and its sll files), it is not installed like other windows apps and was written way before the birth of .NET

Posted 15-Feb-12 9:29am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Yes, I basically know how Smalltalk works. If you can load a regular unmanaged DLL and call some of exported function, it would be enough to load use a .NET assembly, but this is not easy at all. I don't want to discuss a way of implementation of COM component, I'm taking about the ability to export some .NET methods as unmanaged.

Many developers would even say this is absolutely impossible, but this is not true: there is a solution based on CLR standard, but not on pure C#.

The trick is to build a C# project, disassemble it into IL code, modify it to make some methods exported as unmanaged and compile back. Also, there is an automated way to do it: mark those method with some attribute and implement everything else in a special MSBuild task. This way, you can integrate such customized build into your pure-C# project.

If still interested, please first read my answers about this solution:
loading C# DLL in MFC[^],
How can I use a dll created in Visual Basic 2008 in Visual Basic 6.0[^],
Call Managed DLL written in C# from Unmanged Code VC++[^],
API's in .Net: Managed or UnManaged Code[^].

You will find further references to CodeProject articles with source code and detailed explanation.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 15 Feb 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100