NETMF / netmf-interpreter

.NET Micro Framework Interpreter
http://netmf.github.io/netmf-interpreter/
Other
486 stars 224 forks source link

Interop without Solution Wizard #285

Open djaquez opened 9 years ago

djaquez commented 9 years ago

I am new to writing interop code for NetMF so I read through the wiki page on interop here: https://github.com/NETMF/netmf-interpreter/wiki/Interop%20Layer

It says to follow the article by @smaillet-ms which has been helpful in understanding how interop works. However, now there is no solution wizard from 4.4 forward. I am not sure how to proceed with the section "Adding the feature to your solution". Can we get some pointers on what to do from here? Maybe there could be a wiki or something that describes what the wizard did automatically that we now would need to do manually.

Thanks!

djaquez commented 9 years ago

I was able to run the Solution Wizard from the 4.3 porting kit. The output in most files was useless but I did see what changes were made to include the interop project that I was adding to the CLR. It was actually quite simple.

To manually add the project into the build take the following steps:

  1. Open the TinyCLR.proj file that you are interested in. i.e. $(SPOCLIENT)\Solutions<processor/platform>\TinyCLR\TinyCLR.proj
  2. Add the project reference to the end of the list of projects i.e. Insert the following if you are following interop article from @smaillet-ms
    <ItemGroup>
            <DriverLibs Include="Microsoft_SPOT_HAL.$(LIB_EXT)" />
            <RequiredProjects Include="$(SPOCLIENT)\DeviceCode\Interop\Microsoft_SPOT_HAL\NativeCode\Microsoft_SPOT_HAL\dotnetmf.proj" />
  </ItemGroup>

Doing this I was able to build the 4.4 release of the CLR for the MCBSTM32F400 solution successfully.

I have not yet actually made the interop call from managed code. That's up next.

Now, I don't know if there are important caveats to what I mentioned in this post. Would it be possible to update the interop page on the wiki with what must be done to create an interop class without a Solution Wizard? That would be much appreciated.

Thank you.

djaquez commented 9 years ago

I finally got back to working on interop with NetMF. I also was successfull in making an interop call into native code. I missed adding a reference to the .featureproj file to the TinyCLR.proj file. To do that add the following at about line 75

    <Import Project= "$(SPOCLIENT)\DeviceCode\Interop\Microsoft_SPOT_HAL\NativeCode\Microsoft_SPOT_HAL\Microsoft.SPOT.HAL.featureproj" />