Click here to Skip to main content
15,879,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

Thanks
UKJohn
Posted

1 solution

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.

—SA
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900