leadedge / ofxNDI

An Openframeworks addon to allow sending and receiving images over a network using the NewTek Network Device Protocol.
GNU General Public License v3.0
134 stars 48 forks source link

Issues with CopyMemory and unsigned __int32 on macOs #23

Closed dimitre closed 2 years ago

dimitre commented 2 years ago

Just writing to let you know macOs complain about the absence of CopyMemory function and __int32 data type in your addon. Thanks

PS: I could make it run with the following:

#define CopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length))

I've heard internally it is the same function. and changing unsigned int32 to int32_t

leadedge commented 2 years ago

Thanks Dimitre, yes you are right. CopyMemory is a Windows function and it can be simply replaced by memcpy. I think __int32_t should be OK. I will check when I get up to this. Meanwhile if you can make those changes manually it will solve the problem. The ReadTexturePixels has been revised recently so I hope it is OK for MacOS.

dimitre commented 2 years ago

super. in fact I have an error right there

Screen Shot 2021-11-18 at 00 17 04
leadedge commented 2 years ago

It looks like the glBufferStorage extension is not defined. What I might do is put in an alternative function that does not require glBufferStorage and see if that works.

leadedge commented 2 years ago

I replaced the ReadTexturePixels function with a previous version to avoid the problem. I also changed "unsigned __int32" to "uint32_t". This had been an issue previously.

dimitre commented 2 years ago

Great! Everything running here!

For me it is working when compiling to rosetta (intel) with debug option. Release for Intel complain for intrinsics in some lines, it is falling out of #ifdef __x86_64__ for some reason. it is the same error as trying to compile for Apple Silicon:

Use of undeclared identifier '__builtin_ia32_readeflags_u32'

Thank you!

leadedge commented 2 years ago

I will look into that, but it might be difficult to guess.

dimitre commented 2 years ago

Thanks, in fact this Debug / Release is probably an OpenFrameworks unexpected behavior. just opened an issue here https://github.com/openframeworks/openFrameworks/issues/6784#issuecomment-974186565

if yes it will explain this one too https://github.com/leadedge/ofxNDI/issues/19

leadedge commented 2 years ago

OK I hope something comes of this. Meanwhile if the workaround is a solution, maybe that could be documented. Does it solve issue #19 as well?

I have not found any clear reason for the error message, but somewhere I found that order of include could be important.

Move the block of intrinsic includes up to just after "#include "ofxNDIplatforms.h""

That's about all I can suggest right now.

dimitre commented 2 years ago

Thank you! everything fixed here

leadedge commented 2 years ago

Thanks for your time with this. All works fine with Windows.