Addon getting information from external database (MySQL)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2009-04-07
01:49 PM
- last edited on
2023-08-03
05:18 PM
by
Doreena Deng
I have the following problem:
I need to make an addon for Archicad12, that operates with data from mysql database. I wrote basic addon with some menu and handlers for them, now i need to connect to mysql, but can't do anything.
I tried to use OdbcConnection from System.Data.dll, but to compile such a project I need to use /clr compilation option that conflicts with /Gr (__fastcall), so here I got nothing.
Then I tried to use mysql++ api, after reading manual and cleaning all errors addon was built, but AC wrote me something about addon is old for current version... 😞 (commenting all places of using external functions makes addon up-to-date - it's magic). What's the problem with it here?
Can anybody help me to connect to Mysql in any way?
P.S. I use MS Visual Studio 2005.
- Labels:
-
Add-On (C++)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2009-04-09 07:17 AM
I am sorry, I cannot help to connect to MySQL as I do not know the subject. But I have one idea about possible reason.
May be there are dependencies on some external DLLs, after linking to mysql++ library. May be DLLs are not found and addon is not loaded. It is just a guess, but check up DLL dependences and put it into right place, if it is.
Oleg.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2009-04-09 11:41 AM
I don't know why, but I consider Archicad doesn't like addons using external, not his native libraries. It's a pity...
But I don't see another way, because I need to 1)build objects on my model,2)get its description,3)probably change this data (it's optional) according to entries in my external database.
Does Archicad gives such an opportunity??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2009-04-09 11:48 AM
Ivan wrote:The message that "the add-on is an old version" is really a euphemism for "something went wrong when the add-on was loaded but I don't know why".
Then I tried to use mysql++ api, after reading manual and cleaning all errors addon was built, but AC wrote me something about addon is old for current version...(commenting all places of using external functions makes addon up-to-date - it's magic). What's the problem with it here?
It could be a problem with loading dynamic libraries. I haven't linked an add-on to MySQL, so I can't be certain. I have used many other APIs with add-ons though, and you generally have an option for static or dynamic linking with 3rd party SDKs. I would recommend trying static linking if possible.
Central Innovation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2009-04-09 12:53 PM
I tried native mysql.h header and libraries and had the same...
Could you show me some examples of your usage of libraries? have you tried to connect to any database?
And can I use system package (e.g. system.data.odbc)?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2009-04-09 02:15 PM
Ivan wrote:Where you place this test dll ?
I created my own simple dll with function returning just number, connected it to my archicad addon project, compiled it (without errors and visual studio could get an access to my dll for sure) and Archicad wrote me the same message...
Try to put it into root folder of Archicad and do the test.
PS:
I am use number of DLLs (mine and third party), but I load it by LoadLibraryEx etc. May be something changed, but if I remember well, there was a problem and external DLL you linked can not be placed at your AddOn's place.
Oleg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2009-04-10 04:15 AM
I put it into Archicad folder and addon launched.
So,I must put every dll I use into Archicad folder?
I never wrote dlls, could you show me the example of how to use LoadLibraryEx inside archicad addon and to access to this dll?
I will be grateful to you very much!!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2009-04-10 05:45 AM
Ivan wrote:If you will use so-called "load-time dynamic linking" linking to corresponding lib for dll, then you DLL have to placed into one of locations which Windows will search. (see details in the MSDN)
So,I must put every dll I use into Archicad folder?
So it is Archicad or System32 or Windows folders (last may be your option for MySql)
Ivan wrote:Other way is so called "run-time dynamic linking". You dont link to the lib of dll. You have to load it directly by LoadLibrary ( or LoadLibraryEx ), then GetProcAddress for every functions you will use. This way is more hard.
I never wrote dlls, could you show me the example of how to use LoadLibraryEx inside archicad addon and to access to this dll?
See MSDN for details as it is long story.
I dont think there is one best universal way. It is dependent on details etc.
If you wish use MySQL universally and many functions of it's API, then may be better way to install DLLs into Windows folder.
If you want do limited, specific using of MySql, then may be better other way:
create your dll, which will do your specific tasks, export functions from it.
Link this dll directly to MySql libs ("load-time dynamic linking").
Place this dll and all MySQL's dll at your AddOn. Dont link the Addon to the DLL. Load the DLL by LoadLibraryEx with LOAD_WITH_ALTERED_SEARCH_PATH flag, so MySql DLLs will loaded automatically.
Do GetProcAddress for your exported functions and use it.
I think it is sound complex (and my poor English too), so may be better for just to put external DLLs into Windows folder.
Good luck
Oleg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2009-04-10 06:05 AM
I'll try to do this!
Can I communicate with you in case of any troubles by e-mail (what is it?)?