Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » Linking to a .net DLL ?
Re: Linking to a .net DLL ? [message #33370 is a reply to message #33368] Thu, 28 July 2011 23:12 Go to previous messageGo to previous message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
Hey Koldo,

Should this work for a .NET compiled DLL? I am trying the following


AgiRadar::AgiRadar()
{
//	connecting to .net DLL to use the following functions

//	Public Shared Function testFunc1() As Integer
//	    Return 123
//	End Function
	
//	Public Shared Function testFunc2(ByVal x As Double) As Double
//	    Return x * x
//	End Function

	Dl turbineSpeedCalc;

	String myDllFolder = "D:\\temp\\test\\Debug\\";

/////////////////////////////////////////	

	double (*testFunc2)(double);
	
	if (!turbineSpeedCalc.Load(AppendFileName(myDllFolder, "turbineSpeedCalc.dll")))
	    throw Exc(Format(t_("% dll not found"), "turbineSpeedCalc"));
	
	testFunc2 = (double (*)(double))turbineSpeedCalc.GetFunction("testFunc2");
	
	if (!testFunc2)
	    throw Exc(Format(t_("Function %s was not found in dll"), "testFunc2"));
	
	double argOut = testFunc2(15.0);	
	
	String s = Format("answer is %f",argOut);
	PromptOK(s);
	
//////////////////////////////////////////
	
	int (*testFunc1)();
	
	if (!turbineSpeedCalc.Load(AppendFileName(myDllFolder, "turbineSpeedCalc.dll")))
	    throw Exc(Format(t_("% dll not found"), "turbineSpeedCalc"));
	
	testFunc1 = (int (*)())turbineSpeedCalc.GetFunction("testFunc1");
	
	if (!testFunc1)
	    throw Exc(Format(t_("Function %s was not found in dll"), "testFunc1"));
	
	double argOut2 = testFunc1();	
	
	s = Format("answer is %f",argOut2);
	PromptOK(s);
	
}


is there a way to list the functions available in a DLL? I figure if I can get these simple functions to work then I should be able to pass structs and arrays to real functions.

It successfully finds and loads the DLL but fails to find either function.

Cheers,

Nick

[Updated on: Thu, 28 July 2011 23:14]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PrinterJob prints blank pages in linux
Next Topic: Getting compile errors, I modeled after TreeCtrlDnd, but I can't see the error
Goto Forum:
  


Current Time: Sat May 04 15:16:31 CEST 2024

Total time taken to generate the page: 0.02612 seconds