Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set -sMAXIMUM_MEMORY = 4GB & use uuid #1384

Open
XiaoShu2020ace opened this issue May 20, 2024 · 1 comment
Open

set -sMAXIMUM_MEMORY = 4GB & use uuid #1384

XiaoShu2020ace opened this issue May 20, 2024 · 1 comment

Comments

@XiaoShu2020ace
Copy link

If MAXIMUM-MEMORY=4GB is set and the uuid library is used, there will be issues with the code in the'. js' file after compilation;

Interface: _uid_unparse (uu, out) {}

The function uses the 'upper' parameter, but it is not declared;

But if automatic growth is not set and the MAXIMUM-MEMORY compilation instruction is removed, the above function takes the parameter: 'upper'

@sbc100
Copy link
Collaborator

sbc100 commented May 20, 2024

Can you give more context here? The uuid_unparse function takes an optional third parameter: https://github.com/emscripten-core/emscripten/blob/2e3d7f108f0c278f1aab56bebac4497f7a28ec46/src/library_uuid.js#L103-L106

Where is this parameter not declared? Are you referring perhaps the automaticly generated typescript bindings? Can you perhaps share all of the link flags you are using?

When I build a program using this function I see the correct signature in the output, and it does use the upper argument:

/** @param {number|boolean=} upper */ function _uuid_unparse(uu, out, upper) {   
  uu >>>= 0;                                                                     
  out >>>= 0;                                                                    
  var i = 0;                                                                     
  var uuid = "xxxx-xx-xx-xx-xxxxxx".replace(/[x]/g, function(c) {                
    var r = upper ? (HEAPU8[(uu) + (i) >>> 0]).toString(16).toUpperCase() : (HEAPU8[(uu) + (i) >>> 0]).toString(16);
    r = (r.length === 1) ? "0" + r : r;                                          
    i++;                                                                         
    return r;                                                                    
  });                                                                            
  stringToUTF8(uuid, out, 37);                                                   
}  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants