Compilation error for patch string outlets (patch/outlet string)


#1

While building (sub)patches for the Axoctrl, I've come across a problem with the patch string outlet. Apparently it produces the following compilation error:

invalid conversion from 'const char*' to 'char*'

I've opened a pull request on axoloti-factory github repo with a fix: https://github.com/axoloti/axoloti-factory/pull/7

I am not sure if this is the right place for me to post this; if this needs to be posted elsewhere I'll gladly do so.


#2

We can try tagging @johannes, the creator of Axoloti and see what he says.


#3

Ps. It actually used to work long time ago. I have used them in the past. But at some point they didnt work anymore. Not sure what happened.


#4

..I just stumbled upon the same error..
cheers R


#5
error: invalid conversion from 'const char*' to 'char*'

Same Here


#6

Just ran into the same thing. Anyone ever get this figured out, or a workaround?

@hohum @jaffasplaffa @rbrt @johannes @korb @SmashedTransistors

I am trying to mux a set of encoders to control several sets of parameters and need these outlets to let each of my control subpatches talk to the screen...


#7

"const char*" refers to a pointer to character storage (basically, unsigned, 8 bit integer type) that is constant (the value of the character cannot be changed via this pointer). References to static strings often have this type. Somewhere the code is trying to assign a pointer of this type to one without the "const" qualifier. A typical case is passing a string constant as a parameter to a function expecting a char * - Somefunc("string value"); If the method does not alter the string via the pointer and the definition is editable, the argument should really become a const char * to handle cases like this. Otherwise, store the constant string in a variable and pass a pointer to that to the method - but make sure the storage you are pointing at will not go out of scope while the pointer needs to be valid.

Hope this helps.

Regards,
John


#8

A workaround is to 'embed as patch/object', then change the 'Local Data' declaration to :
const char * _outlet;

This should get it working, but it's not the best solution.


#9

Definitely above my pay grade :sweat_smile:

I tried this but when updating the subpatch the outlet does not appear on the object.


#10

I'm not quite sure how to use or test the 'patch/outlet string' object. Just to be clear, this is the object you're trying to use?


#11

Yup, that's the object. I am using it with @SmashedTransistors oled objects. I can test that it works (not sure how it works outside of this use case) but I can't get the the outlet to show to even try --

Here's a simplified view:

Create a patcher object. Within it I create a "patch/outlet string", which I then embedded and updated per your last post. Close the patcher and click update, but no outlet appears on the patcher. As you can see, the audio outlet I added shows no problem.

EDIT -- I just tested what happens when I embedded the audio outlet and we get the same result: the outlet disappears.


#12

Ahhh, I see what you mean. I'm out of ideas for now.


#13

I appreciate the help regardless!


#14

Sorry, this is a topic I don't know too much about.

I have no idea what happened to that object. I thought it was fixed by now, to be honest.

@SmashedTransistors and @tele_player definitely knows a lot more about this stuff than I do, so better to listen to them :wink:


#15

Looking at the java code which constructs these builtin objects, I'm just getting confused. I think the source code I've downloaded doesn't match what is actually installed by the latest stable version of the Axoloti app. And I've never tried to actually build the java app, I'm pretty certain I don't have the Java compiler installed on my Mac.


#16

So, patch/outlet string has the non-const char * - what is being connected with the const char *? Maybe it can be changed at that side? This is basically a type mis-match due to const on one side of an assignment and not the other. To fix it, the two sides have to be brought into agreement.

Regards,
John


#17

Hey all, I have a fix for this in the linked pull request: https://github.com/axoloti/axoloti-factory/pull/7/files
If you locate your factory folder, you can apply the same change and have it working. It is just too bad that the pull request still isn't merged.

Edited the link to go directly to the changed file


#18

I don't know how to fix this.
I tried to make a local copy of the patch/outlet string so that i can experiment with the code... and i did not achieved at all to have an outlet out of the patcher.


#19

That's a tricky one !

To be recognised as an outlet, the object seems to need to be in the patch directory.
If i put it in the tiar/patch directory, it is not recognised as an outlet !

and even more, it seems that the object must be called "outlet string".

Maybe there is something hard coded in the editor ?


Anyway,
In the gcc documentation i found a way to deactivate the limitation.

#pragma GCC diagnostic push
#pragma GCC diagnostic warning "-fpermissive"
_outlet = inlet_outlet;
#pragma GCC diagnostic pop

Here is the object:
outlet string.axo (749 Bytes)

It must be placed in a directory called "patch" under your object folder.

On a PC it means its path must be

 C:\Users\User\Documents\axoloti\objects\patch\outlet string.axo

so that it is recognized by the editor as an outlet.


Some insight from coders familiar with the editor internals would be great (i like to understand why it seems to work this way).


#20

Here is how I fixed it: in my Documents folder, there is the axoloti folder. You can find the file you need to change at axoloti-factory/objects/patch/outlet string.axo. All you need to do is edit this file (don't make a copy but instead make adjustments to this file) with a plain text editor.

Look for:
<code.krate><![CDATA[ _outlet = inlet_outlet;
and change that to:
<code.krate><![CDATA[ _outlet = (char *)inlet_outlet;

After this you probably have to (re)start the Axoloti application.
Hope this helps! If there is anything unclear or you need more help, please let me know!