Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8348597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:44:20+00:00 2026-06-09T07:44:20+00:00

I have a Lua module ( lpack ) that I need to load into

  • 0

I have a Lua module (lpack) that I need to load into LuaInterface. I’ve tried a few different configurations for the project, but I can’t seem to figure out the linking.

I get the error unresolved external symbol "void __stdcall lua_replace(struct lua_State *,int)" (?lua_replace@@YGXPAUlua_State@@H@Z) referenced in function "int __stdcall l_unpack(struct lua_State *)" (?l_unpack@@YGHPAUlua_State@@@Z)

If I run dumpbin /exports on the lua51.lib file, I can find ?lua_replace@@YAXPAUlua_State@@H@Z which matches what I find in the lua51.dll with Dependency Walker ?lua_replace@@YAXPAUlua_State@@H@Z, so the function exists but the names don’t match.

I’m not very familiar with this level of linker management, so this may be a simple error on my part. Why is the value in the lpack build not matching that of the lua51.lib input file?

Update

All of the exports in the lua51.dll and lua51.lib files were __cdecl and my lpack project has been set to __stdcall. Changing that property (under C/C++ -> Advanced -> Calling Convention) fixed the compile issue and I now have an lpack.dll file.

However, when I attempt to load the file from lua require('lpack') it fails with The specified procedure could not be found.

Breaking in the lua C code that loads the library with LoadLibraryA returns NULL and a GetLastError() code of 0x7F.

Update 2

The lpack.dll file I was attempting to load was out of date due to a wrong output directory, so that fixed the LoadLibrary failure. Next the GetProcAddress would fail, but if I added extern "C" to the export function in the lpack.c file as per Mud’s recommendation, the problem was resolved.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:44:22+00:00Added an answer on June 9, 2026 at 7:44 am

    However, when I attempt to load the file from lua require(‘lpack’) it fails with The specified procedure could not be found.

    Probably because the name is mangled. Did you look in the DLL to see the actual (mangled) name of the function?

    You really ought to build the Lua source (and any Lua modules written in C) as C, and use extern "C" when importing them. Save you a lot of headaches.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a python project that relies on some lua files, one of which
I'm trying to create a library that I can load into Lua with require
I have a Lua program that is consuming data from an external device. The
I have the following lua script : module(modoo,package.seeall) foo=1 bar={12,34} Which works fine using
I have a c++ application that interfaces with lua files. I have a lua
I have embedded Lua in an Objective-C application using LuaObjCBridge. I need to know
I have embedded Lua on Win32 in my project by means of statically linking
I started programming in Lua few days ago. I have become familiar with the
I'm running Lighttpd on Cygwin. I have a Lua CGI script that calls a
I have gotten Lua scripting in C# working via LuaInterface, and javascript scripting working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.