Click here to Skip to main content
15,897,704 members
Home / Discussions / C#
   

C#

 
AnswerRe: Windows Service Question Pin
PIEBALDconsult14-Apr-09 17:54
mvePIEBALDconsult14-Apr-09 17:54 
QuestionProblem linking with C++ function Pin
Alan Balkany14-Apr-09 8:01
Alan Balkany14-Apr-09 8:01 
AnswerRe: Problem linking with C++ function Pin
Luc 64801114-Apr-09 8:12
Luc 64801114-Apr-09 8:12 
GeneralRe: Problem linking with C++ function Pin
Alan Balkany14-Apr-09 8:25
Alan Balkany14-Apr-09 8:25 
AnswerRe: Problem linking with C++ function Pin
Alan Balkany14-Apr-09 8:31
Alan Balkany14-Apr-09 8:31 
GeneralRe: Problem linking with C++ function Pin
Luc 64801114-Apr-09 8:42
Luc 64801114-Apr-09 8:42 
GeneralRe: Problem linking with C++ function Pin
Alan Balkany14-Apr-09 8:46
Alan Balkany14-Apr-09 8:46 
GeneralRe: Problem linking with C++ function Pin
Luc 64801114-Apr-09 9:36
Luc 64801114-Apr-09 9:36 
Hi Alan,

I did some experiments using VS2008 Express for both C++ and C# and all went well, here is the relevant code:

#define NATIVECPPEXPERIMENT_API __declspec(dllexport)

NATIVECPPEXPERIMENT_API int fint1(int arg1) {
	return arg1*arg1;
}

NATIVECPPEXPERIMENT_API int fint4(int arg1,int arg2, short* arg3, int arg4) {
	*arg3=(short)(arg1*arg2);
	return arg1*arg4;
}


namespace ConsoleApplication1 {
	class Program {
		static void log(string s) {Console.WriteLine(s);}

		static void Main(string[] args) {
			int res1=cppfint1(12);
			log("res1="+res1);
			short shrt=14;
			int res4=cppfint4(12,13,ref shrt, 15);
			log("res4="+res4);
			log("shrt="+shrt);
			Console.ReadLine();

		}

		[DllImport("nativeCppExperiment.dll", EntryPoint="?fint1@@YAHH@Z")]
		static extern int cppfint1(int arg1);

		[DllImport("nativeCppExperiment.dll", EntryPoint="?fint4@@YAHHHPAFH@Z")]
		static extern int cppfint4(int agr1, int arg2, ref short arg3, int arg4);
	}
}


So either you are overlooking something, or your system is ill. I suggest you try closing and reopening Studio, and consider rebooting.

Smile | :)
GeneralRe: Problem linking with C++ function Pin
Alan Balkany14-Apr-09 10:00
Alan Balkany14-Apr-09 10:00 
GeneralRe: Problem linking with C++ function Pin
Luc 64801114-Apr-09 10:19
Luc 64801114-Apr-09 10:19 
GeneralRe: Problem linking with C++ function Pin
Alan Balkany14-Apr-09 10:35
Alan Balkany14-Apr-09 10:35 
GeneralRe: Problem linking with C++ function Pin
Luc 64801114-Apr-09 10:57
Luc 64801114-Apr-09 10:57 
GeneralRe: Problem linking with C++ function Pin
Luc 64801114-Apr-09 11:10
Luc 64801114-Apr-09 11:10 
GeneralRe: Problem linking with C++ function Pin
Alan Balkany14-Apr-09 11:20
Alan Balkany14-Apr-09 11:20 
GeneralRe: Problem linking with C++ function Pin
Luc 64801114-Apr-09 11:22
Luc 64801114-Apr-09 11:22 
QuestionWindows Mobile USB Port Pin
Justin Talley14-Apr-09 6:57
Justin Talley14-Apr-09 6:57 
AnswerRe: Windows Mobile USB Port Pin
Giorgi Dalakishvili14-Apr-09 8:15
mentorGiorgi Dalakishvili14-Apr-09 8:15 
GeneralRe: Windows Mobile USB Port Pin
Justin Talley15-Apr-09 6:44
Justin Talley15-Apr-09 6:44 
Questionhow to write '&' in xml Pin
novhard14-Apr-09 6:46
novhard14-Apr-09 6:46 
AnswerRe: how to write '&' in xml Pin
0x3c014-Apr-09 6:53
0x3c014-Apr-09 6:53 
AnswerRe: how to write '&' in xml Pin
Jimmanuel14-Apr-09 8:12
Jimmanuel14-Apr-09 8:12 
GeneralRe: how to write '&' in xml Pin
0x3c014-Apr-09 10:17
0x3c014-Apr-09 10:17 
GeneralRe: how to write '&' in xml Pin
Jimmanuel14-Apr-09 10:40
Jimmanuel14-Apr-09 10:40 
GeneralRe: how to write '&' in xml Pin
novhard14-Apr-09 12:38
novhard14-Apr-09 12:38 
QuestionHow to develop a Addin for my own Application Pin
MartinMueller14-Apr-09 6:12
MartinMueller14-Apr-09 6:12 

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.