Advertisement

05.14.2003 at 11:11AM PDT, ID: 20616346
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Excel for MacOSX - integration with C++ dynamic libs

Asked by eredhuin in General Macintosh Programming

Tags: , ,

I would like to call my own C/C++ code from Excel X on the mac. I have done this using Win32 for work and can generate DLL's using cygwin/gcc and MSVC. The Excel VBA interface in win32 requires a "Declare Function" like

Declare Function get_answer Lib "c:\bar\foo.dll" (ByRef Y As Double) As Integer

I would like to be able to do the same thing in Mac OS X, which I am a new switcher to. I have regular unix programming experience so I figured I could create a dynamic link library and such, and the process would somehow be simpler, because the Win32 DLL syntax is a bit arcane. But I can't find documentation.

Do I want a bundle? A shared lib? A framework?

Say I have the function in Win32 like

int get_answer(double *d) {
/* do something */
return 42;
}

I have "Mac OS X for Unix Geeks" open in front of me and I can create a .dylib or .bundle from this. e.g.

cc -O -fno-common foo.c -c
cc -dynamiclib -install_name libfoo.dylib -o libfoo.dylib foo.o

But I have no luck when I try accessing "/Path/to/libfoo.dylib" from within Excel X's VBA editor.

First guess is that I need to have a bunch of standard includes (e.g. in windows you use "windows.h") and some declares (probably not __declspec(dllexport) though). Finding details here is a bit tricky. The MSDN site has tantalizing mentions of "macintosh" here and there, but I can't find enough information to do anything.

Can someone post a pointer to some sample "hello world" code that can be built using gcc and linked with vba in excel? Start Free Trial
 
Loading Advertisement...
 
[+][-]06.27.2003 at 11:04AM PDT, ID: 8815268

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: General Macintosh Programming
Tags: excel, dylib, mac
Sign Up Now!
Solution Provided By: Alex Curylo
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.11.2003 at 12:04PM PDT, ID: 8905227

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32