FX file fails to allow custom types to be passed

When attempting to link a library via a FX file, the namespaces do not match in regards to passing a custom data structure.

ConsoleApplication3_fx.zip (2.2 MB)

This is still missing Library2. One complete test case pls. ideally with both projects and a project reference between them.

Ok, I was manually adding the reference to the FX file which should be in this ZIP instead of linking the projects together.

Edit: I’ve uploaded a screenshot to the project in VS so you can check the manner of how it’s meant to be compiled. The manual reference to Library2.fx is added to the solution then imported in the code as Imports Library2. The Library2 project is compiled separately which has been uploaded in the other thread. Adding it to the current solution just compiles them both individually.

This seems as designed. Your Library defines (and exports) test.test2 as a struct, and exposes a method that expects this struct.

Your console app defines ANOTHER struct test2. which happens to look the same, but the compiler doesn’t know/care about that, it’s a different struct as far as it’s concerned. As such, the parameter is not what testFunc expects and the error is valid (if a it confusing, I admit)

		testFunc(t) // E486 Parameter 1 is "Test.test2", should be "Test.test2", in call to Test.testFunc(t: Test.test2)

What makes matters worse is that the stardust in Library are private/internal, so they cant be used from externally. You would need to change their visibility to Public and drop the (re-)declaration in 7th console app.

What confuses me is why the compiler does not object to using a private type in a public API. that should be an error when compiling the library, and I’ll log an issue for that.

1 Like

Logged as bugs://E26764.

Unfortunately, this test case does not include the source for Library2, and the several other copies I have dont seem to match what im seeing.

This is precisely why I ask for complete test cases, because guessing around like this is just no good.

Can you please update this testcase to incliude

(a) the console app, as it does now
(b) the library project, in the exact same version you’re using
(c) a project reference between the two

thanx you.

The only thing is when I made the structures public (even the module itself), the new reference fails to see the definition.

Once I’ll have a full test case I’ll check this properly.

The library project should be referenced in the console solution.

LibraryFX test.zip (2.2 MB)

Logged as bugs://E26765.

Thanx. Reproduced; definitely something wrong with the visibility of the types exposed why the lib.