Click here to Skip to main content
16,018,158 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: [API] Add a dll Pin
Mark Salsbery24-Feb-07 9:12
Mark Salsbery24-Feb-07 9:12 
GeneralRe: [API] Add a dll Pin
abbd24-Feb-07 9:24
abbd24-Feb-07 9:24 
GeneralRe: [API] Add a dll Pin
Mark Salsbery24-Feb-07 9:29
Mark Salsbery24-Feb-07 9:29 
GeneralRe: [API] Add a dll Pin
abbd24-Feb-07 9:48
abbd24-Feb-07 9:48 
GeneralRe: [API] Add a dll Pin
Mark Salsbery24-Feb-07 10:02
Mark Salsbery24-Feb-07 10:02 
QuestionRe: [API] Add a dll Pin
abbd24-Feb-07 12:34
abbd24-Feb-07 12:34 
AnswerRe: [API] Add a dll Pin
Mark Salsbery24-Feb-07 19:38
Mark Salsbery24-Feb-07 19:38 
Questionexport function Error Pin
snouto24-Feb-07 4:25
snouto24-Feb-07 4:25 
hello everybody in this forum.

i have some problems .

i want to make a dll in C++ that i can use in C# i declare the function by

<br />
extern "C" __declspec(dllexport) void DisplayMessage()<br />
{<br />
  std::cout << "Hello world !!!";<br />
}<br />

when i call this function , from C# using interoperability services , the calling is excellent and i can call this function from Managed code.


ok but when i try to make a class for the following example
<br />
class Grade<br />
{<br />
public:<br />
void DisplayMessage();<br />
};<br />
<br />
//then its implementation<br />
public Grade<br />
{<br />
void DisplayMessage()<br />
{<br />
  std::cout << "Hello Snouto Override" <<std::endl;<br />
}<br />
}<br />
<br />
<br />
//then in my external function that will be called from dotnet (C#).<br />
extern "C" __declspec(dllexport) void ShowMessage()<br />
{<br />
  Grade current_grade;<br />
  current_grade.DisplayMessage();<br />
}<br />

then when i create and compile the above code into .dll using win32 Dll Project.
<br />
//in the C# Console Application<br />
[DllImport(mydll.dll)]<br />
public static extern void ShowMessage();<br />
<br />
<br />
private static void Main(string[] args)<br />
{<br />
   ShowMessage();<br />
}<br />


i have error telling me NullReferenceException was thrown but i don't know why.

Human knowledge belongs to the world.

QuestionIf I start from C,What the language should I continue to develope program on Windows? Pin
Vithaya24-Feb-07 2:55
Vithaya24-Feb-07 2:55 
AnswerRe: If I start from C,What the language should I continue to develope program on Windows? Pin
Chris Losinger24-Feb-07 6:26
professionalChris Losinger24-Feb-07 6:26 
Questionnamespace problem Pin
david bagaturia24-Feb-07 0:26
david bagaturia24-Feb-07 0:26 
AnswerRe: namespace problem Pin
Gary R. Wheeler24-Feb-07 1:42
Gary R. Wheeler24-Feb-07 1:42 
AnswerRe: namespace problem Pin
Hamid_RT24-Feb-07 19:58
Hamid_RT24-Feb-07 19:58 
GeneralRe: namespace problem Pin
david bagaturia25-Feb-07 18:44
david bagaturia25-Feb-07 18:44 
GeneralRe: namespace problem Pin
Hamid_RT25-Feb-07 19:25
Hamid_RT25-Feb-07 19:25 
Questionneed ur help Pin
Member 386021724-Feb-07 0:24
Member 386021724-Feb-07 0:24 
AnswerRe: need ur help Pin
Cedric Moonen24-Feb-07 2:43
Cedric Moonen24-Feb-07 2:43 
AnswerRe: need ur help Pin
Mark Salsbery24-Feb-07 6:44
Mark Salsbery24-Feb-07 6:44 
GeneralRe: need ur help Pin
Michael Dunn24-Feb-07 15:16
sitebuilderMichael Dunn24-Feb-07 15:16 
AnswerRe: need ur help Pin
Bram van Kampen24-Feb-07 14:46
Bram van Kampen24-Feb-07 14:46 
GeneralRe: need ur help Pin
normanS25-Feb-07 0:22
normanS25-Feb-07 0:22 
QuestionHow to convert LPWSTR to string? Pin
amitmistry_petlad 23-Feb-07 22:39
amitmistry_petlad 23-Feb-07 22:39 
AnswerRe: How to convert LPWSTR to string? Pin
Christian Graus23-Feb-07 22:54
protectorChristian Graus23-Feb-07 22:54 
AnswerRe: How to convert LPWSTR to string? Pin
Stephen Hewitt24-Feb-07 2:08
Stephen Hewitt24-Feb-07 2:08 
Questionrelated to network module Pin
sudhir.marni23-Feb-07 22:31
sudhir.marni23-Feb-07 22:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.