RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Using dllexport on a function with the __clrcall convention

Using dllexport on a function with the __clrcall convention

Hi there, I'm pretty new to using C++ after using C# for a while now and so the syntax and that is pretty similar...
Anyway what I am trying to do is make a DLL in C++ that will interact with the Ultima.dll. I want to do this because I am writing a form that runs from within the runuo server and so it is impossible to add Ultima.dll as a reference and Ultima.dll doesn't export it's functions so I can't use dllimport in my C# code of my form. So basically I'm writing my C++ DLL that has a reference to Ultima.dll in it and then I am writing functions in my C++ dll to export bitmaps created using the functions from Ultima.dll.
However I'm having a problem with exporting my functions from my C++ dll because of the following error:
Code:
error C3395: 'UltimaHelper::Gumps::GetGump' : __declspec(dllexport) cannot be applied to a function with the __clrcall calling convention
Here is my UltimaHelper.dll code in C++:
Code:
#pragma once
using namespace System;
using namespace Ultima;

namespace UltimaHelper 
{
    public class __declspec(dllexport) Gumps
    {
        public: static System::Drawing::Bitmap^  GetGump(int index)
        {
            System::Drawing::Bitmap^ returnImage = Ultima::Gumps::GetGump(index);
            return returnImage;
        }

    };
}
Thanks for any help
 

arul

Sorceror
C++ projects compiled with /clr parameter are compiled into IL, and thus you can use them within your managed project with no problem.

__declspec may be used only if you compile into native code, which can be achieved through some #pragma macro.
 
Ok, so if you dont mind me asking some further questions...
What is a Pragma macro? What would one look like for me to be able to export my function?
 
Top