Cosmos icon indicating copy to clipboard operation
Cosmos copied to clipboard

Add plug for Interop+Kernel32.CompareStringEx

Open notbothered opened this issue 4 years ago • 15 comments

Area of Cosmos - What area of Cosmos are we dealing with?

project properties

Expected Behaviour - What do you think that should happen?

should be a Cosmos and cosmos new tab

Actual Behaviour - What unexpectedly happens?

tabs missing

Reproduction - How did you get this error to appear?

create new cosmos project

Version - Were you using the User Kit or Dev Kit? And what User Kit version or Dev Kit commit (Cosmos, IL2CPU, X#)?

user kit 20200708

notbothered avatar Aug 29 '20 19:08 notbothered

Are both extensions installed and can you build the project?

quajak avatar Aug 29 '20 21:08 quajak

yes and yes. It runs in vmware. The only reason I have an issue is because I want to generate an iso

notbothered avatar Aug 29 '20 22:08 notbothered

Is there another way to force it to create an iso?

notbothered avatar Aug 29 '20 22:08 notbothered

Does this also happen if you create the a new project? The iso is also generated when you launch with vmware, just check under bin.

quajak avatar Aug 30 '20 09:08 quajak

yes and no. It sometimes does it. If it creates an app with the tabs, then I can't reference most things, for example strings. I can't use instr(), mid(), LCase() etc. If I add them as imports, the system just tells me the imports aren't necessary. I've probably done something stupid, but I can't see what. I had been looking in the Bin folder for the iso, but it doesn't seem to create one when running in vmware. I have been able to get the iso from there with other projects which is what makes me think I've probably changed something. I have removed and reinstalled everything a few times, in various orders and configurations in order to try and sort this out. I've installed Cosmos both from the precompiled exe and by building it myself, but with no change. I did notice this morning that sometimes when a new project is created, the first thing it does is throw an error saying some projects weren't loaded correctly - at this point, before hitting the reload button, the tabs are there, but any settings changes are not retained. As soon as I hit the reload, the tabs disappear.

notbothered avatar Aug 30 '20 09:08 notbothered

I started again from scratch, I now have the tabs, I have the option to create an ISO. I have copied in all the code from the faulty project and intellisense says there are no errors. However, when I build it I get a system exception from IL2CPU. It says Native code encountered, plug required. How do I find out what needs plugging? The error report mentions line numbers, but they don't seem to bear any relation to the code itself.

notbothered avatar Aug 30 '20 20:08 notbothered

Can you post the entire output log? Your line of code should be somewhere in the stack.

quajak avatar Aug 31 '20 06:08 quajak

I've started again. I remmed out everything, then gradually reintroduce the code. It falls over on anything containing an if statement. I created a new project, which ran. I added If input ="fred" then console.writeline("bob") - it fell over. IL2CPU exception. Am I missing a reference? Error output below; 1>------ Build started: Project: CosmosKernel5, Configuration: Debug Any CPU ------ 1>CosmosKernel5 -> C:\Users\Bah Humbug\source\repos\CosmosKernel5\CosmosKernel5\bin\Debug\netcoreapp2.0\cosmos\CosmosKernel5.dll 1>Message: Executing IL2CPU on assembly 1>Message: Kernel Base: Cosmos.System.Kernel 1>Message: Checking target assembly: C:\Users\Bah Humbug\source\repos\CosmosKernel5\CosmosKernel5\bin\Debug\netcoreapp2.0\cosmos\CosmosKernel5.dll 1>IL2CPU : error : Exception: System.Exception: 1>Native code encountered, plug required. 1> DO NOT REPORT THIS AS A BUG. 1> Please see http://www.gocosmos.org/docs/plugs/missing/ 1> Need plug for: System.Int32 Interop+Kernel32.CompareStringEx(System.Char*, System.UInt32, System.Char*, System.Int32, System.Char*, System.Int32, System.Void*, System.Void*, System.IntPtr). 1> Called from : 1>System.Globalization.CompareInfo::Int32 CompareString(System.String, Int32, Int32, System.String, Int32, Int32, System.Globalization.CompareOptions) 1>System.Globalization.CompareInfo::Int32 Compare(System.String, System.String, System.Globalization.CompareOptions) 1>Microsoft.VisualBasic.CompilerServices.EmbeddedOperators::Int32 CompareString(System.String, System.String, Boolean) 1>CosmosKernel5.CosmosKernel5.Kernel::Void Run() 1>Cosmos.System.Kernel::Void Run() 1> 1> 1> at Cosmos.IL2CPU.ILScanner.ScanMethod(MethodBase aMethod, Boolean aIsPlug, String sourceItem) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 617 1> at Cosmos.IL2CPU.ILScanner.ScanQueue() in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 770 1> at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod, IEnumerable`1 plugsAssemblies) in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\ILScanner.cs:line 264 1> at Cosmos.IL2CPU.CompilerEngine.Execute() in C:\Development\Cosmos\IL2CPU\source\Cosmos.IL2CPU\CompilerEngine.cs:line 200 1>IL2CPU task took 00:00:02.6371945 1>Done building project "CosmosKernel5.vbproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

notbothered avatar Aug 31 '20 12:08 notbothered

Yeah that plug should be added. Best would be plugging System.Globalization.CompareInfo::Int32 Compare.

quajak avatar Aug 31 '20 13:08 quajak

how would I go about that? I know nothing of assembler. Is there an alternative? Thanks for all your help, by the way.

notbothered avatar Aug 31 '20 13:08 notbothered

I can't be the only person to compare two strings, is there a method that does work?

notbothered avatar Aug 31 '20 15:08 notbothered

Most people use C#, which doesnt require this plug. The plug can be written in pure C# but requires the devkit.

quajak avatar Aug 31 '20 17:08 quajak

ok thanks. I'll find a way round it eventually. an array of chars is looking hopeful...

notbothered avatar Aug 31 '20 17:08 notbothered

I will look into plugging today, as this should be supported by cosmos.

quajak avatar Aug 31 '20 17:08 quajak

Stale issue message

github-actions[bot] avatar Apr 26 '21 01:04 github-actions[bot]