|
||
|
|||||||
| C/C++ C/C++ Discussion |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Expert
Join Date: Jan 2004
Location: England
Age: 20
Posts: 442
|
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 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;
}
};
}
__________________
David's Sig is my Sig. He always says it best.
|
|
|
|
|
|
#2 (permalink) |
|
Forum Expert
|
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.
__________________
Angels are falling the very last time, down they're burning in hate and decline, unfaithful and violent we're breaking the spell, we're god, we're scissor, in heaven and hell! |
|
|
|
|
|
#3 (permalink) |
|
Forum Expert
Join Date: Jan 2004
Location: England
Age: 20
Posts: 442
|
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?
__________________
David's Sig is my Sig. He always says it best.
|
|
|
|
|
|
#4 (permalink) |
|
Forum Expert
|
There's a nice article about it over at CodeProject.
http://www.codeproject.com/dotnet/managed_unmanaged.asp
__________________
Angels are falling the very last time, down they're burning in hate and decline, unfaithful and violent we're breaking the spell, we're god, we're scissor, in heaven and hell! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|