Missing Method

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

Missing Method

Post by Horst »

Hello
I installed the new 2,18 and i try now to eliminate the warnings. Maybe this warnings comes already with 2.16 and i did not fix it.

warning XS9118: Untyped parameter 'l_x' and 'PASCAL' calling convention, assuming 'REAL' type. 1126,31 PDF StringBuilder.prg New_MDPDF:Image
warning XS9118: Untyped parameter 'l_y' and 'PASCAL' calling convention, assuming 'REAL' type. 1126,35 PDF StringBuilder.prg New_MDPDF:Image
warning XS9118: Untyped parameter 'l_w' and 'PASCAL' calling convention, assuming 'REAL' type. 1126,39 PDF StringBuilder.prg New_MDPDF:Image

Code: Select all

Original
METHOD Image(l_file AS STRING,l_x,l_y,l_w,l_h := 0 AS REAL,l_type := '' AS STRING) AS VOID PASCAL 
my try
METHOD Image(l_file AS STRING,l_x AS REAL8,l_y AS REAL8,l_w AS REAL8,l_h := 0 AS REAL8,l_type := '' AS STRING) AS VOID PASCAL 
If i change the original method only a little, the compiler works (some warnings still in other methods) but NO errors

Then when i run the app:

System.MissingMethodException: Methode nicht gefunden: "Void New_MDPDF.Image(System.String, Single, Single, Single, Single, System.String)".

the same with this change

Code: Select all

//METHOD Image(l_file AS STRING,l_x,l_y,l_w,l_h := 0 AS REAL,l_type := '' AS STRING) AS VOID PASCAL 
METHOD Image(l_file AS STRING,l_x,l_y,l_w,l_h := 0 AS REAL) AS VOID PASCAL 
	LOCAL l_P 		AS INT
	LOCAL l_type :=""	AS STRING
Horst
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Missing Method

Post by robert »

Horst,
This is a new warning.
If you change the types in your code to "REAL4" then it will work

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

Re: Missing Method

Post by Horst »

Hello Robert

I tried it. With real4 it works but not with real8 . Why ?

Then i changed the code from

Code: Select all

METHOD Image(l_file AS STRING,l_x AS REAL4,l_y AS REAL4,l_w AS REAL4,l_h := 0 AS REAL4,l_type := '' AS STRING) AS VOID PASCAL 
to

Code: Select all

METHOD Image(l_file AS STRING,l_x AS REAL4,l_y AS REAL4,l_w AS REAL4,l_h := 0 AS REAL4) AS VOID PASCAL 
	LOCAL l_type :=""	AS STRING
Error when the app is running ,with 6 Parameter instead of 5 ??????
System.MissingMethodException: Methode nicht gefunden: "Void New_MDPDF.Image(System.String, Single, Single, Single, Single, System.String)".


And i have this also.

CONSTRUCTOR (l_orientation, l_unit, l_fontpath, l_imagepath, dMarginLeft , dMarginTop)
i changed to
CONSTRUCTOR (l_orientation AS STRING, l_unit, l_fontpath, l_imagepath, dMarginLeft , dMarginTop)

and then

System.MissingMethodException: Methode nicht gefunden: "Void New_MDPDF..ctor(XSharp.__Usual[])".

Horst

ps_ all warnings maybe that helps
warning XS9118: Untyped parameter 'l_x' and 'PASCAL' calling convention, assuming 'REAL' type. 1246,36 Pdf.prg pdfImage
warning XS9118: Untyped parameter 'l_y' and 'PASCAL' calling convention, assuming 'REAL' type. 1246,40 Pdf.prg pdfImage
warning XS9118: Untyped parameter 'l_w' and 'PASCAL' calling convention, assuming 'REAL' type. 1246,44 Pdf.prg pdfImage
warning XS9118: Untyped parameter 'l_x1' and 'PASCAL' calling convention, assuming 'REAL8' type. 1416,18 Pdf.prg pdfLine
warning XS9118: Untyped parameter 'l_y1' and 'PASCAL' calling convention, assuming 'REAL8' type. 1416,23 Pdf.prg pdfLine
warning XS9118: Untyped parameter 'l_x2' and 'PASCAL' calling convention, assuming 'REAL8' type. 1416,28 Pdf.prg pdfLine
warning XS9118: Untyped parameter 'l_x' and 'PASCAL' calling convention, assuming 'REAL8' type. 1515,18 Pdf.prg pdfRect
warning XS9118: Untyped parameter 'l_y' and 'PASCAL' calling convention, assuming 'REAL8' type. 1515,22 Pdf.prg pdfRect
warning XS9118: Untyped parameter 'l_w' and 'PASCAL' calling convention, assuming 'REAL8' type. 1515,26 Pdf.prg pdfRect
warning XS9118: Untyped parameter 'l_x' and 'PASCAL' calling convention, assuming 'REAL8' type. 1661,19 Pdf.prg pdfSetXY
warning XS9076: Empty IF block. Insert a NOP statement to suppress the warning, if this was intentional. 2354,2 Func.prg TurnImagePart2
warning XS9076: Empty ELSE block. Insert a NOP statement to suppress the warning, if this was intentional. 1255,2 Pdf Klasse.prg MDPDF:Image
warning XS9076: Empty ELSE block. Insert a NOP statement to suppress the warning, if this was intentional. 1353,2 Pdf Klasse.prg MDPDF:.ctor
warning XS9076: Empty ELSE block. Insert a NOP statement to suppress the warning, if this was intentional. 1365,2 Pdf Klasse.prg MDPDF:.ctor
warning XS9076: Empty ELSE block. Insert a NOP statement to suppress the warning, if this was intentional. 1513,2 Pdf Klasse.prg MDPDF:SetDisplayMode
warning XS9118: Untyped parameter 'l_w' and 'PASCAL' calling convention, assuming 'REAL8' type. 615,19 Pdf Klasse.prg MDPDF:_multicell
warning XS9118: Untyped parameter 'l_w' and 'PASCAL' calling convention, assuming 'REAL8' type. 1045,13 Pdf Klasse.prg MDPDF:Cell
warning XS9118: Untyped parameter 'l_x' and 'PASCAL' calling convention, assuming 'REAL8' type. 1121,17 Pdf Klasse.prg MDPDF:DrawLink
warning XS9118: Untyped parameter 'l_x' and 'PASCAL' calling convention, assuming 'REAL8' type. 1152,17 Pdf Klasse.prg MDPDF:DrawText
warning XS9118: Untyped parameter 'l_x' and 'PASCAL' calling convention, assuming 'REAL' type. 1213,31 Pdf Klasse.prg MDPDF:Image
warning XS9118: Untyped parameter 'l_y' and 'PASCAL' calling convention, assuming 'REAL' type. 1213,35 Pdf Klasse.prg MDPDF:Image
warning XS9118: Untyped parameter 'l_w' and 'PASCAL' calling convention, assuming 'REAL' type. 1213,39 Pdf Klasse.prg MDPDF:Image
warning XS9118: Untyped parameter 'l_x1' and 'PASCAL' calling convention, assuming 'REAL8' type. 1385,13 Pdf Klasse.prg MDPDF:Line
warning XS9118: Untyped parameter 'l_y1' and 'PASCAL' calling convention, assuming 'REAL8' type. 1385,18 Pdf Klasse.prg MDPDF:Line
warning XS9118: Untyped parameter 'l_x2' and 'PASCAL' calling convention, assuming 'REAL8' type. 1385,23 Pdf Klasse.prg MDPDF:Line
warning XS9118: Untyped parameter 'l_w' and 'PASCAL' calling convention, assuming 'REAL8' type. 1411,18 Pdf Klasse.prg MDPDF:MultiCell
warning XS9118: Untyped parameter 'l_x' and 'PASCAL' calling convention, assuming 'REAL8' type. 1474,13 Pdf Klasse.prg MDPDF:Rect
warning XS9118: Untyped parameter 'l_y' and 'PASCAL' calling convention, assuming 'REAL8' type. 1474,17 Pdf Klasse.prg MDPDF:Rect
warning XS9118: Untyped parameter 'l_w' and 'PASCAL' calling convention, assuming 'REAL8' type. 1474,21 Pdf Klasse.prg MDPDF:Rect
warning XS9118: Untyped parameter 'l_x' and 'PASCAL' calling convention, assuming 'REAL8' type. 1617,14 Pdf Klasse.prg MDPDF:SetXY
warning XS9118: Untyped parameter 'l_w' and 'PASCAL' calling convention, assuming 'REAL8' type. 632,19 PDF StringBuilder.prg New_MDPDF:_multicell
warning XS9118: Untyped parameter 'l_w' and 'PASCAL' calling convention, assuming 'REAL8' type. 1067,13 PDF StringBuilder.prg New_MDPDF:Cell
warning XS9118: Untyped parameter 'l_x' and 'PASCAL' calling convention, assuming 'REAL8' type. 1143,17 PDF StringBuilder.prg New_MDPDF:DrawLink
warning XS9118: Untyped parameter 'l_x' and 'PASCAL' calling convention, assuming 'REAL8' type. 1174,17 PDF StringBuilder.prg New_MDPDF:DrawText
warning XS9118: Untyped parameter 'l_x1' and 'PASCAL' calling convention, assuming 'REAL8' type. 1402,13 PDF StringBuilder.prg New_MDPDF:Line
warning XS9118: Untyped parameter 'l_y1' and 'PASCAL' calling convention, assuming 'REAL8' type. 1402,18 PDF StringBuilder.prg New_MDPDF:Line
warning XS9118: Untyped parameter 'l_x2' and 'PASCAL' calling convention, assuming 'REAL8' type. 1402,23 PDF StringBuilder.prg New_MDPDF:Line
warning XS9118: Untyped parameter 'l_w' and 'PASCAL' calling convention, assuming 'REAL8' type. 1428,18 PDF StringBuilder.prg New_MDPDF:MultiCell
warning XS9118: Untyped parameter 'l_x' and 'PASCAL' calling convention, assuming 'REAL8' type. 1490,13 PDF StringBuilder.prg New_MDPDF:Rect
warning XS9118: Untyped parameter 'l_y' and 'PASCAL' calling convention, assuming 'REAL8' type. 1490,17 PDF StringBuilder.prg New_MDPDF:Rect
warning XS9118: Untyped parameter 'l_w' and 'PASCAL' calling convention, assuming 'REAL8' type. 1490,21 PDF StringBuilder.prg New_MDPDF:Rect
warning XS9118: Untyped parameter 'l_x' and 'PASCAL' calling convention, assuming 'REAL8' type. 1675,14 PDF StringBuilder.prg New_MDPDF:SetXY
Compilation successful! (42 warnings)
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Missing Method

Post by Chris »

Hi Horst,

Those warnings are meant to say that the parameters do not have an explicit type (with an AS clause), but instead get the type of the next parameter that has a specified AS clause (the "l_h" one). Maybe you did it on purpose, maybe it was accidental, but just in case the compiler warns you about it (we had found some cases in code where this was unintended by the programmer, the previous parameters were supposed to have a different type, this is why we introduced the new warning). But if this is just your programming style and prefer to specifiy the type of the parameters like that, then there's nothing wrong with simply disabling the warning and not changing your code at all.

The error about missing method just means that you did not recompile all your apps and libraries after making the change in themethod definition. If you do that, then the error will go away.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: Missing Method

Post by robert »

Horst,
REAL4 - REAL8:
In VO you can abbreviate keywords to 4 characters. We support that too (we have to).
Both REAL4 and REAL8 abbreviate to "REAL".
The compiler chooses REAL4 when you specify the type as REAL.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

Re: Missing Method

Post by Horst »

Hello Chris

it is not my style , the basic of my PDF maker is from Olivier Plathey , it was a vo example. Simple , makes small pdf and fast, i like it.

Its working when i rebuild the whole project, but i dont see that my class needs things from outside the application.

Dll 1 is calling

Code: Select all

oPdf:Image(	AllTrim(WorkDir () + SELF:gcPathUserHtml+"LogoSeite1.jpg"),0,-7,90,0) -> this i did not change
in Dll2 is the class with

Code: Select all

METHOD Image(l_file AS STRING,l_x AS REAL4,l_y AS REAL4,l_w AS REAL4,l_h := 0 AS REAL4) AS VOID PASCAL -> and here i put only the as real4 
Why i have to rebuild all? And its scary , because the error comes when the app ist runing.

Horst
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Missing Method

Post by Chris »

Hi Horst,

The reason is that in .Net (unlike in VO), we have method overloading, we can declare several times a method with the same name, but with different parameters, and for this to work, each of this methods is considered as a completely different method than the others.

When you previously compiled one of your apps using that method (from a library), when generating the IL code for that method call, the compiler only knew the previous definition for the method, so it generated appropriate IL for calling it exactly with those parameters. When you changed the method, but did not recompile the code that is calling this method, the code making the call still assumes the previous method definition, but when executed, this does not exist anymore! For this reason, you need to recompile everything that is using a method, when that method is modified.

Btw, in Visual Studio, by default, every time you make even the tiniest change in a library (even just adding a comment), then it automatically recompiles everything in your project when you try to run your app. In 99% of the cases, this is just a waste of time, and for this reason by default XIDE does not do it, unless you explicitly select from the menu "Project/Build" (which compiles everything that depends on libraries that you have modified), or "Project/Rebuild" (which just builds everything). It's up to the programmer to do this when needed it, and that is when anything in the public interface of a dll is changed (like modifying a method or a property, changing the type of a PROTECT/EXPORT field, deleting a field, changing a class name etc).
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Horst
Posts: 336
Joined: Tue Oct 13, 2015 3:27 pm

Re: Missing Method

Post by Horst »

Hi Chris

Thanks for your explanation.

Horst
Post Reply